如何在表格布局中的列之间设置分隔符? [英] How to set divider between columns in tablelayout?
本文介绍了如何在表格布局中的列之间设置分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用列分隔符创建一个表.我想用竖线图像划分列.为了达到这个目的,我使用了"android:divider="@drawable/abc"
,但是它不起作用.以下是我的xml文件:
I want to create a table with column dividers. I want to divide my columns with a vertical bar image. To achieve this I have used "android:divider="@drawable/abc"
but its not working. Below is my xml file for same:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:stretchColumns="*"
android:padding="5dip"
android:divider="@drawable/tracking_green"
>
<TableRow >
<TextView
android:id="@+id/retaileritem1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="xxxxxxx" />
<TextView
android:id="@+id/retaileritem2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="xxxxxxx" />
<ImageView
android:id="@+id/retailerimage1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/tracking_green" />
</TableRow>
推荐答案
添加android:showDividers ="middle"
Add android:showDividers="middle"
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:stretchColumns="*"
android:padding="5dip"
android:divider="@drawable/tracking_green"
android:showDividers="middle"
>
这篇关于如何在表格布局中的列之间设置分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文