A018-布局之TableLayout
来源:互联网 发布:js根据name获取标签 编辑:程序博客网 时间:2024/06/16 04:31
TableLayout
表格布局,顾名思义像表格一样进行布局。我们通常配合TableRow一起使用,TableRow代表一行,有多少个TableRow就有多少行。
eg:三行三列的布局
<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TableRow> <Button android:text="Button1"/> <Button android:text="Button2"/> <Button android:text="Button3"/> </TableRow> <TableRow> <Button android:text="Button4"/> <Button android:text="Button5"/> <Button android:text="Button6"/> </TableRow> <TableRow> <Button android:text="Button7"/> <Button android:text="Button8"/> <Button android:text="Button9"/> </TableRow></TableLayout>
XML Attribute
shrinkColumns属性,以0为序,当控件布满布局时,指定列自动填充可用部分。
strechColumns属性,以第0行为序,指定列对空白部分进行填充。
collapseColumns属性:以0行为序,隐藏指定的列。
layout_column属性:以0行为序,设置组件显示指定列。
layout_span属性:以第0行为序,设置组件显示占用的列数。
示例代码:
<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- android:shrinkColumns="2" 以0为序,当控件布满布局时,指定列自动填充可用部分。 strechColumns属性,以第0行为序,指定列对空白部分进行填充 collapseColumns属性:以0行为序,隐藏指定的列 --> <TableRow> <Button android:text="Button1" android:layout_span="3"/> <Button android:text="Button2"/> <Button android:text="Button3"/> </TableRow> <TableRow> <Button android:text="Button4" android:layout_column="1"/> <Button android:text="Button5" /> <Button android:text="Button6"/> </TableRow> <TableRow> <Button android:text="Button7"/> <Button android:text="Button8" android:layout_column="2"/> <Button android:text="Button9"/> </TableRow></TableLayout>
转载请注明:IT_xiao小巫 http://blog.csdn.net/wwj_748
0 0
- A018-布局之TableLayout
- Android布局之TableLayout
- Android之TableLayout布局
- android之【TableLayout布局】
- Android之TableLayout布局
- 布局之三 -- TableLayout
- Android 布局之TableLayout
- Android布局之TableLayout
- android布局之TableLayout使用
- android之tableLayout布局之一
- android 开发布局之TableLayout
- 五大布局之TableLayout
- android布局管理器之TableLayout
- android之tableLayout布局之一
- Android UI布局之TableLayout
- Android布局文件之TableLayout
- 布局之TableLayout和FrameLayout
- Android开发之TableLayout布局
- main函数
- iOS 常用控件
- Gym 100685 G Gadget Hackwrench LCA+DFS标记
- 欢迎使用CSDN-markdown编辑器
- 自己的练习二之构造函数与初始化列表
- A018-布局之TableLayout
- 自己的练习三之复制构造函数
- IOS面试题汇总
- AOP运行过程解析
- ASP.NET MVC + Bootstrap + XML + WCF 封装短信验证服务(一)
- 动态变量和静态变量的区别
- 自己的练习四之对象与数组的组合
- iOS 转场动画等
- Ubuntu14.04安装CUDA6.5