Android笔记之TableLayout布局

本文详细介绍了TableLayout的基本用法,包括如何定义表格结构、设置表格宽度、添加行间和列间的分隔线以及调整单元格间距等。适用于Android初学者及需要复习TableLayout用法的开发者。

1、每一个TableLayout 可以包含多个tablerow,每个tablerow即为一行,每个tablerow又可以包含多个控件,每个控件作为一列

2、整个表格的宽度由父容器android:layout_width指定

3、一个列的宽度由该列最宽的那个单元格

 <TableLayout
        android:id="@+id/tablelayout1"
        android:background="#efefbc"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
       >
 <TableRow
            android:layout_width="match_parent"
            android:background="#ffffcc99"
            android:layout_height="wrap_content">
.......
</TableRow>

.......

</TableLayout>

1、列与列之间的竖线:

 <View
                    android:layout_width="1px"
                    android:layout_height="fill_parent"
                    android:background="#000000"/>

 

2、行与行之间的横线:

 <View
                    android:layout_width="fill_parent"
                    android:layout_height="1px"
                    android:background="#000000"/>

3、调整单元格之间的间距:单元格使用padding或margin

 

Done!

转载于:https://www.cnblogs.com/xingyyy/p/3298473.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值