五布局之绝对布局TableLayout
TableLayout表格布局模型以行列的形式管理子控件,每一行为一个TableRow的对象,当然也可以是一个View的对象。
TableLayout的全局属性:
android:collapseColumns= "1,2"
——隐藏从0开始的索引列。
android:shrinkColumns = "1,2"
——收缩从0开始的索引列。可以通过“*”代替收缩所有列。
android:stretchColumns = "1,2"
——拉伸从0开始的索引列以填满多余的空白空间。
TableLayout的局部属性:
android:layout_column- "1"
——控件显示在第2列
android:layout_span = "2"
——控件占据2列
<TableLayout 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" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2" /> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3" /> </TableRow> </TableLayout>
——————————————————————————————————————————————————
——————————————————————————————————————————————————
——————————————————————————————————————————————————
——————————————————————————————————————————————————
——————————————————————————————————————————————————
——————————————————————————————————————————————————
——————————————————————————————————————————————————