您的位置:首页 > 移动开发 > Android开发

Android ApiDemos示例解析(159):Views->Layouts->TableLayout->04.Stretchable

2012-09-07 07:01 417 查看
本例介绍android:stretchColumns 的用法,指定可以延伸的列的序号,以逗号分开,具有stretchable 属性的列可以占据表格的多余控件(类似于LinearLayout中的weight).

<TableLayout xmlns:android=”http://schemas.android.com/apk/res/android”

android:layout_width=”match_parent”

android:layout_height=”match_parent”

android:stretchColumns=”1“>

<TableRow>

< TextView

android:text=”@string/table_layout_4_open”

android:padding=”3dip” />

<TextView

android:text=”@string/table_layout_4_open_shortcut”

android:gravity=”right”

android:padding=”3dip” />

< /TableRow>

<TableRow>

< TextView

android:text=”@string/table_layout_4_save”

android:padding=”3dip” />

<TextView

android:text=”@string/table_layout_4_save_shortcut”

android:gravity=”right”

android:padding=”3dip” />

< /TableRow>

< /TableLayout>

本例为第2列指定了stretchable属性,因此第二列占据表格的多余空间。



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐