LinearLayout 线性布局
//Activity_main.xml
<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:id="@+id/firstText"
android:text="第一行"
android:gravity="center_horizontal"
android:textSize="20pt"
android:background="#aa0000"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:paddingBottom="40dip"
android:paddingRight="30dip"
android:paddingTop="20dip"
android:layout_weight="2"
android:singleLine="true"/>
<TextView
android:id="@+id/secondText"
android:text="第二行"
android:gravity="center_vertical"
android:textSize="15pt"
android:background="#0000aa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"/>
</LinearLayout>
TableLayout表格布局
//Activity_main.xml
<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/row1_coulumn1"
android:background="#aa0000"
android:padding="3dip"/>
<TextView
android:text="@string/row1_coulumn1"
android:background="#00aa00"
android:gravity="center_horizontal"
android:padding="3dip"/>
<TextView
android:text="@string/row2_coulumn2"
android:background="#0000aa"
android:padding="3dip"/>
</TableRow>
<TableRow>
<TextView
android:text="@string/row1_coulumn1"
android:padding="3dip"/>
<TextView
android:text="@string/row2_coulumn2"
android:padding="3dip"/>
</TableRow>
</TableLayout>
一些常用的xml属性