我想创建一个带有列分隔符的表格。我想用竖条图像划分我的列。为此,我使用了 "android:divider="@drawable/abc"
但它不起作用。下面是我的 xml 文件:
<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"
<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"
>
关于android - 如何在表格布局中设置列之间的分隔线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10073211/