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