本例介紹如何在TableLayout中使用空單元格,一種是跳過該單元格,一種是使用不可見的View占據某個單元格:
<TableLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”match_parent”>
<TableRow>
< Button
android:text=”@string/table_layout_2_open” />
<TextView
android:text=”@string/table_layout_2_path_1″
android:padding=”3dip” />
< /TableRow>
< TableRow>
< Button www.aiwalls.com
android:text=”@string/table_layout_2_save_all”/>
< /TableRow>
< TableRow>
< Button
android:text=”@string/table_layout_2_save”
android:visibility=”invisible” />
<TextView
android:text=”@string/table_layout_2_path_2″
android:padding=”3dip” />
< /TableRow>
< /TableLayout>
本例第二行隻定義瞭第一列的單元格,跳過瞭第二列,第三行要不顯示第一列,可以使用一個不可見的View,android:visibility=”invisible”