android学习笔记19--------------tablelayout的均分效果
来源:互联网 发布:淘宝客采集软件赚钱吗 编辑:程序博客网 时间:2024/06/05 20:33
转载请注明出处:http://blog.csdn.net/yf210yf
TableLayout,表格布局采用行列形式管理UI组件,TableLayout不需要明确地声明有多少行和列,而是通过添加TableRow、其它组件来控制表格的行数、列数。
每次向TableLayout添加一个TableRow,就是在向表格添加一行,TableRow也是容器,可以向TableRow中添加组件,每添加一个组件,即是添加一列。
如果直接向TableLayout添加组件,则认为这个组件占用一行。
表格布局中列的宽度即是每一列中最宽的组件的宽度。
使用前:使用后:
<TableLayout android:id="@+id/tableLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:stretchColumns="*" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:text="最近联系人" android:id="@+id/button4" android:layout_width="1dip" android:layout_height="wrap_content"></Button> <Button android:text="联系人" android:id="@+id/button5" android:layout_width="1dip" android:layout_height="wrap_content"></Button> <Button android:text="分组" android:id="@+id/button5" android:layout_width="1dip" android:layout_height="wrap_content"></Button> </TableRow> </TableLayout>
TableLayout 增加一个属性 android:stretchColumns="*" 表示所有列都要自动拉伸,以便适应屏幕宽度。
它的值即可以是数字,也可以是*,注意数字是从0开始的,即:android:stretchColumns="1" 是设置 TableLayout所有行的第二列为扩展列。
上面我们会看到 第1列的按钮比其他列的按钮要宽,如果我们想都一样宽如何办呢?
一个简单办法:
android:layout_width="1dip"- android学习笔记19--------------tablelayout的均分效果
- android学习笔记9:TableLayout
- Android 学习笔记(5) --tablelayout
- Android学习笔记TableLayout布局
- Android学习笔记08:表格布局TableLayout
- android学习笔记02(TableLayout)
- Android表格布局TableLayout学习笔记
- Android学习笔记(12):表格布局TableLayout
- [android]笔记5-TableLayout
- Android UI学习 - TableLayout
- Android TableLayout学习
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- Android学习:TableLayout使用
- Android TableLayout布局学习
- 使用OllyDbg 分析 USB HID 设备接口协议
- 数据库备份、还原的处理
- Sun xVM virtualbox下搭建外网可访问web服务器
- 几个软件研发团队管理的小问题
- startActivity的requires new task异常解析
- android学习笔记19--------------tablelayout的均分效果
- linux内核分析笔记----定时器和时间管理
- “Traceroute”程序知多少
- 尽量不要使用默认的东西
- C# winform treeview 刷新前,记录上次折叠情况,刷新后,恢复到上次情况
- Oracle9i冷备克隆数据库到异机Step By Step
- google ProtoBuf开发者指南
- 程序人生之九:2012,回首这7年
- 嵌入式Linux开发培训资料整理