Android登陆界面
时间: 2023-12-30 18:24:48 浏览: 36
以下是一个Android登录界面的示例代码:
```xml
<!-- activity_login.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/logo" />
<EditText
android:id="@+id/et_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:background="@drawable/edittext_bg" />
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:background="@drawable/edittext_bg" />
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:background="@drawable/button_bg" />
</LinearLayout>
```
在上面的示例中,我们使用了两个自定义的背景文件:`edittext_bg.xml`和`button_bg.xml`。`edittext_bg.xml`用于设置输入框的背景样式,`button_bg.xml`用于设置按钮的背景样式。你可以根据自己的需求修改这两个文件来定制登录界面的样式。