android界面线性布局

    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"//垂直排列
    android:background="@drawable/ic_launcher"
    tools:context=".Addressbook" >
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:orientation="horizontal"//水平排列
   >
            android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="用户名"
        android:textSize="20sp"
        />
            android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:hint="请输入用户名"
        android:inputType="textPersonName"
        />

   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:orientation="horizontal"
   android:layout_marginTop="20dp"
   >
           android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="密    码"
       android:textSize="20sp"
       />
           android:layout_width="0dp"
       android:layout_weight="1"
       android:layout_height="wrap_content"
       android:hint="请输入密码"
       android:inputType="textPassword"
       />

   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:orientation="horizontal"
   android:layout_marginTop="20dp"
   >
           android:layout_width="0dp"
       android:layout_weight="1"
       android:layout_height="wrap_content"
       android:text="登陆"
       android:textSize="20sp"
       />
           android:layout_width="0dp"
       android:layout_weight="1"
       android:layout_height="wrap_content"
       android:text="注册"
       android:textSize="20sp"
       />

你可能感兴趣的:(android界面线性布局)