1、LinearLayout(线性布局)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/mobile" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/mobile" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button"
android:id="@+id/button"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
2、RelativeLayout(相对布局)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/number"
android:id="@+id/numberlabel" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/number"
android:layout_toRightOf="@id/numberlabel"
android:layout_alignTop="@id/numberlabel"
android:layout_marginLeft="5dp"/>
</RelativeLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/content" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:maxLines="3"
android:id="@+id/content"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button"
android:id="@+id/button"/>
</LinearLayout>
3、TableLayout(表格布局 两行两列)
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
Android:stretchColumns="1">
<TableRow>
<TextView
android:text="@string/table_lable1"
android:padding="3dip"/>
<TextView
android:text="@string/table_lable2"
android:gravity="right"
android:padding="3dip"/>
</TableRow>
<TableRow>
<TextView
android:text="@string/table_lable1"
android:padding="3dip"/>
<TextView
android:text="@string/table_lable2"
android:gravity="right"
android:padding="3dip"/>
</TableRow>
</TableLayout >
4、FrameLayout(帧布局)显示控件会进行叠加,后者会叠加在前者之上
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/movie" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/play"
android:layout_gravity="center"/>
</FrameLayout>