<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5.0sp"
android:layout_marginRight="5.0sp"
android:layout_marginTop="10.0sp"
android:stretchColumns="1" >
<!--TableRow 表示行,每行里面就可以 通过其他View来实现我们想要的方格-->
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff000000" >
<TextView
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:background="#ffffffff"
android:gravity="center"
android:text="表格布局带表格线"
android:textColor="#ff000000"
android:textSize="25.0sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff000000" >
<TextView
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:layout_marginBottom="1.0dip"
android:layout_marginLeft="1.0dip"
android:layout_marginTop="1.0dip"
android:layout_weight="1.0"
android:background="#ffffffff"
android:gravity="center"
android:padding="6.0dip"
android:text="第一行"
android:textColor="#ff000000"
android:textStyle="bold" />
<TextView
android:id="@+id/delivercompanyname"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:layout_marginBottom="1.0dip"
android:layout_marginLeft="1.0dip"
android:layout_marginTop="1.0dip"
android:layout_weight="1.0"
android:text="第二行"
android:background="#ffffffff"
android:gravity="center"
android:textColor="#ff000000" />
<TextView
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:layout_marginBottom="1.0dip"
android:layout_marginLeft="1.0dip"
android:layout_marginTop="1.0dip"
android:layout_weight="1.0"
android:background="#ffffffff"
android:gravity="center"
android:padding="6.0dip"
android:text="第三行"
android:textColor="#ff000000"
android:textStyle="bold" />
<TextView
android:id="@+id/repairtime"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:layout_marginBottom="1.0dip"
android:layout_marginLeft="1.0dip"
android:layout_marginRight="1.0dip"
android:layout_marginTop="1.0dip"
android:layout_weight="1.0"
android:text="第四行"
android:background="#ffffffff"
android:ellipsize="marquee"
android:gravity="center"
android:textColor="#ff000000" />
</TableRow>
</TableLayout>
</RelativeLayout>
android:background=”#ff000000”背景设置成黑色,
android:layout_marginBottom="1.0dip"
android:layout_marginLeft="1.0dip"
android:layout_marginTop="1.0dip"
android:background="#ffffffff"
设置背景为白色,通过与上边缘下边缘左边缘相隔1dip,这样就实现了表格有了表格线,当最下面有一个大黑色的背景,上面在一个白色背景重叠并且白色背景的小于黑色背景这样就出现了表格线,我们如果要设置表格线的粗细只需设置他们相隔多少dip就行