以下是一个简单的 Android 登录界面的示例代码:
```xml
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="16dp"> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登录" android:textSize="24sp" android:layout_gravity="center_horizontal" android:layout_marginBottom="16dp" /> android:id="@+id/username_edittext" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="用户名" android:inputType="text" /> android:id="@+id/password_edittext" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="密码" android:inputType="textPassword" />
```
在这个示例中,我们创建了一个垂直方向的 LinearLayout,包含了以下元素:
1. 一个标题文本视图,显示"登录"。
2. 两个 EditText 控件,用于输入用户名和密码。
3. 一个 Button 控件,用于执行登录操作。
当用户输入用户名和密码并点击"登录"按钮时,您需要在 Java 代码中编写相应的登录逻辑,例如验证用户名和密码,并执行相应的操作。
您可以根据需要自定义布局和样式,如添加图标、调整字体大小和颜色等,以使登录界面更加美观。同时,也要考虑登录界面的用户体验,如添加错误提示、进度指示器等。