[Android开发从零开始].13.Table_Layout学习

来源:互联网 发布:音频矩阵和视频矩阵 编辑:程序博客网 时间:2024/05/23 16:26

表格布局是一个ViewGroup以表格显示它的子视图(view)元素,即行和列标识一个视图的位置。Android的表格布局跟HTML中的表格布局非常类似,TableRow 就像HTML表格的标记。

TableLayout常用的属性
 android:collapseColumns:隐藏指定的列
 android:shrinkColumns:收缩指定的列以适合屏幕,不会挤出屏幕
 android:stretchColumns:尽量把指定的列填充空白部分
 android:layout_column:控件放在指定的列
 android:layout_span:该控件所跨越的列数

源码

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    >    <TableRow>        <Button            android:text="Button11"            />        <Button            android:text="Button12"            />        <Button            android:text="Button13"            />    </TableRow>    <TableRow>        <Button            android:text="Button21"            />        <Button            android:layout_span="2"            android:text="Button23"            />    </TableRow></TableLayout>

显示效果:
这里写图片描述

0 0
原创粉丝点击