Android ApiDemos示例解析(157):Views->Layouts->TableLayout->02. Empty Cells
2012-09-06 20:50
495 查看
本例介绍如何在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
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”
<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
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”
相关文章推荐
- Android ApiDemos示例解析(166):Views->Layouts->TableLayout->11. Gravity
- Android ApiDemos示例解析(158):Views->Layouts->TableLayout->03.Long Content
- Android ApiDemos示例解析(167):Views->Layouts->TableLayout->12. Cell Spanning
- Android ApiDemos示例解析(159):Views->Layouts->TableLayout->04.Stretchable
- Android ApiDemos示例解析(161):Views->Layouts->TableLayout->06. More Spanning and Stretchable
- Android ApiDemos示例解析(160):Views->Layouts->TableLayout->05. Spanning and Stretchable
- Android ApiDemos示例解析(156):Views->Layouts->TableLayout->01. Basic
- Android ApiDemos示例解析(163):Views->Layouts->TableLayout->08. Toggle Stretch
- Android ApiDemos示例解析(162):Views->Layouts->TableLayout->07. Column Collapse
- Android ApiDemos示例解析(164):Views->Layouts->TableLayout->09. Toggle Shrink
- Android ApiDemos示例解析(165):Views->Layouts->TableLayout->10. Simple Form
- Android ApiDemos示例解析(149):Views->Layouts->LinearLayout->9. Layout Weight
- Android ApiDemos示例解析(147):Views->Layouts->LinearLayout->7. Fill Parent
- Android ApiDemos示例解析(141):Views->Layouts->LinearLayout->1. Vertical
- Android ApiDemos示例解析(142):Views->Layouts->LinearLayout->2. Vertical (Fill Screen)
- Android ApiDemos示例解析(148):Views->Layouts->LinearLayout->8. Gravity
- Android ApiDemos示例解析(152):Views->Layouts->RelativeLayout->2.Simple Form
- Android ApiDemos示例解析(150):Views->Layouts->LinearLayout->10. Background Image
- Android ApiDemos示例解析(145):Views->Layouts->LinearLayout->5.Simple Form
- Android ApiDemos示例解析(151):Views->Layouts->RelativeLayout->1. Vertical