安卓 之 表单布局

这里写图片描述

<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就行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值