机器人:如何显示TableLayout边界 [英] android: how to display border of TableLayout

查看:189
本文介绍了机器人:如何显示TableLayout边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能突出tablelayout的边界...
即时通讯使用roundshape.xml具有形状为背景,必须有某种方式,我可以给边框您tablelayout ...

roundshape.xml

 <?XML版本=1.0编码=UTF-8&GT?;
<形状的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:形状=矩形>    <角落的an​​droid:半径=5dip/>    <梯度
        机器人:角=270
        机器人:ENDCOLOR =@色/的WhiteSmoke
        机器人:startColor =@色/的WhiteSmoke
        机器人:类型=线性/>< /形状>

=的WhiteSmoke#F5F5F5

main.xml中

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:方向=垂直>    < TableLayout
        机器人:layout_width =400dp
        机器人:layout_height =400dp
        机器人:背景=@绘制/ roundshape
         >        <的TableRow
            机器人:ID =@ + ID / tableRow1
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>        < /&的TableRow GT;        <的TableRow
            机器人:ID =@ + ID / tableRow2
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>
        < /&的TableRow GT;        <的TableRow
            机器人:ID =@ + ID / tableRow3
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>
        < /&的TableRow GT;        <的TableRow
            机器人:ID =@ + ID / tableRow4
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>
        < /&的TableRow GT;
    < / TableLayout>< / LinearLayout中>


解决方案

我想这可能帮助ü..办理code你也会找出伎俩

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:方向=垂直>    < TableLayout
        机器人:layout_width =400dp
        机器人:layout_height =400dp
        机器人:背景=@绘制/ roundshape>        <的TableRow
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:背景=#FF9>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1像素
                机器人:文字=/>
        < /&的TableRow GT;        <的TableRow
            机器人:ID =@ + ID / tableRow1
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:文字=这是惊人的/>
        < /&的TableRow GT;        <的TableRow
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:背景=#FF9>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1像素
                机器人:文字=/>
        < /&的TableRow GT;        <的TableRow
            机器人:ID =@ + ID / tableRow2
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:文字=这是惊人的/>
        < /&的TableRow GT;        <的TableRow
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:背景=#FF9>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1像素
                机器人:文字=/>
        < /&的TableRow GT;        <的TableRow
            机器人:ID =@ + ID / tableRow3
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:文字=这是惊人的/>
        < /&的TableRow GT;        <的TableRow
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:背景=#FF9>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1像素
                机器人:文字=/>
        < /&的TableRow GT;        <的TableRow
            机器人:ID =@ + ID / tableRow4
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:文字=这是惊人的/>
        < /&的TableRow GT;        <的TableRow
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =1像素
            机器人:背景=#FF9>            <的TextView
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1像素
                机器人:文字=/>
        < /&的TableRow GT;
    < / TableLayout>< / LinearLayout中>

how can i highlight the border of the tablelayout... im using roundshape.xml which has shape as a background there must be some way by which i can give the border around your tablelayout...

roundshape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <corners android:radius="5dip" />

    <gradient
        android:angle="270"
        android:endColor="@color/WhiteSmoke"
        android:startColor="@color/WhiteSmoke"
        android:type="linear" />

</shape>

WhiteSmoke =#F5F5F5

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TableLayout
        android:layout_width="400dp"
        android:layout_height="400dp"
        android:background="@drawable/roundshape"
         >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>
    </TableLayout>

</LinearLayout>

解决方案

i think this might help u.. go through code u will figure out the trick

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TableLayout
        android:layout_width="400dp"
        android:layout_height="400dp"
        android:background="@drawable/roundshape" >

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#ff9" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="1px"
                android:text="" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="this is amazing" />
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#ff9" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="1px"
                android:text="" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="this is amazing" />
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#ff9" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="1px"
                android:text="" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="this is amazing" />
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#ff9" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="1px"
                android:text="" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="this is amazing" />
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#ff9" >

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="1px"
                android:text="" />
        </TableRow>
    </TableLayout>

</LinearLayout>

这篇关于机器人:如何显示TableLayout边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆