TableLayout实现均匀布局(条目横向1:1排列)
2016-04-05 10:49
204 查看
像下面的布局效果,我们经常使用LinearLayout实现,其实也可以使用TableLayout去简单的实现
代码如下:
这里有几个属性需要设置:
android:stretchColumns=”*”
TableRow里面的子view宽度统一设置成一个固定值如1dp
代码如下:
<TableLayout android:layout_width="match_parent" android:layout_height="match_parent" android:padding="@dimen/spacing_small" android:stretchColumns="*"> <TableRow> <TextView style="@style/GrayText" android:layout_width="1dp" android:text="订单号" /> <TextView style="@style/GrayText" android:layout_width="1dp" android:text="预定时间" /> </TableRow> <TableRow android:layout_marginTop="@dimen/spacing_tiny"> <TextView android:id="@+id/order_num" style="@style/BlackText" android:layout_width="1dp" android:text="201687" /> <TextView android:id="@+id/time" style="@style/Bl 4000 ackText" android:layout_width="1dp" android:text="2016年3月24日" /> </TableRow> <TableRow android:layout_marginTop="@dimen/spacing_normal"> <TextView style="@style/GrayText" android:layout_width="1dp" android:text="出行目的" /> <TextView style="@style/GrayText" android:layout_width="1dp" android:text="订单状态" /> </TableRow> <TableRow android:layout_marginTop="@dimen/spacing_tiny"> <TextView android:id="@+id/aim" style="@style/BlackText" android:layout_width="1dp" android:text="商务谈判" /> <TextView android:id="@+id/order_status" style="@style/BlueText" android:layout_width="1dp" android:text="出票中" /> </TableRow> </TableLayout>
这里有几个属性需要设置:
android:stretchColumns=”*”
TableRow里面的子view宽度统一设置成一个固定值如1dp
相关文章推荐
- win7系统卸载Windows Virtual PC虚拟机的图解教程
- 树状数组
- Cocoapods的安装及使用(整理)
- 《深度探索C++对象模型》笔记(一)
- linux 下 opencv配置
- Docker技术学习
- Velocity快速入门教程-脚本语法详解(转)
- 读写锁
- java final
- PHP 实现文件的writeInt writeUTF readInt readUTF
- ListView的优化整理
- matlab处理矩阵的一些简易操作和画图的一些小技巧
- 元素垂直居中方法
- POJ3468 A Simple Problem with Integers 题解&代码
- android安卓手机分屏多窗口实现方法
- MyBatis学习总结(二)——使用MyBatis对表执行CRUD操作
- smart学习之旅
- 好朋友
- 软件开发方法:
- 一款优秀的OA办公系统有哪些功能?