界面布局代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/home_page_bg"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="center"
></TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="center"
></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="center_horizontal"
>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/home_page_login" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:gravity="center_horizontal">
<Button android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/home_page_register"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@drawable/button01_a"
/>
<Button android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@drawable/button02_a"
/>
<Button android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@drawable/button03_a"
/>
<Button android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@drawable/button04_a"
/>
<Button android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@drawable/button05_a"
/>
</LinearLayout>
</LinearLayout>
这里红线是设置对应成比例