登陆界面的线性布局代码
时间: 2023-05-30 15:05:10 浏览: 60
以下是一个简单的登陆界面的线性布局代码:
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<ImageView
android:src="@drawable/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="32dp"/>
<EditText
android:id="@+id/username_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:inputType="text"
android:maxLines="1"
android:padding="16dp"
android:textSize="18sp"/>
<EditText
android:id="@+id/password_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:maxLines="1"
android:padding="16dp"
android:textSize="18sp"/>
<Button
android:id="@+id/login_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:textSize="18sp"
android:layout_marginTop="32dp"/>
</LinearLayout>
```
该布局文件使用了一个垂直方向的线性布局,并包含了一个应用程序图标、一个用户名输入框、一个密码输入框以及一个登陆按钮。每个控件都使用了相应的属性来设置它们的大小、颜色、提示文本等。