android:如何显示TableLayout的边框

标签 android tablelayout

如何突出显示表格布局的边框... 我正在使用以形状作为背景的 roundshape.xml

圆形.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>

白烟=#F5F5F5

主.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>

最佳答案

我认为这可能会帮助你..通过代码你会找出诀窍

<?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>

关于android:如何显示TableLayout的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11781723/

相关文章:

java - 设置android.webkit.Web TextView类的文本颜色?

c# - Xamarin.Forms 在文件系统中保存文件

Android - 使用现有的 TableRow 布局将 TableRow 动态添加到 TableLayout

Android:如何在 TableLayout 中滑动列?

css - 基于 Internet Explorer 百分比的布局问题

java - 如何删除状态栏和主屏幕之间的分隔线/阴影?

android - 如何在 Android 中设置 SocketIO 的传输?

javascript - Nativescript:无法创建应用程序...无法加载模块:...app/main.js

html - 显示一些表格数据,但它具有动态布局。分区? table ?

android - 如何设置按钮背景图像以动态地将内容包装在表格布局中