<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<!--LinearLayout线性布局
vertical垂直排列
horizontal水平排列
android:layout_gravity="center"
给线性布局里面的控件所添加的属性
-->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="登录" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="注册" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!--
RelativeLayout相对布局
android:layout_centerInParent="true"水平垂直居中
android:layout_certerVertical="true"垂直居中
android:layout_centerHorizontal="true"水平居中
控件在某控件的右方此属性写在哪个个控件
就指代此控件相对于另一个
android:layout_above="@id/login"
android:layout_below="@id/login"
android:layout_toLeftOf="@id/login"
android:layout_toRightOf="@id/login"
-->
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="登录" />
<Button
android:id="@+id/register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_above="@id/login"
android:text="注册" />
</RelativeLayout>