有它在ListView中用作一行TableLayout底部边框 [英] Have bottom border for TableLayout which is used as row in ListView
问题描述
根据开放片面的Android中风?,大致有2种方式来实现边界为TableLayout。
According to Open-sided Android stroke?, there are basically 2 ways to implement borders for TableLayout.
使用笔画
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00ffffff"/>
<stroke android:width="1dp" android:color="#ffffff"/>
</shape>
不过,这不是我想要的,我只希望下边框的东西。因此,我尝试另一种选择。
However, this is not something which I want, as I only want bottom border. Hence, I try another alternative.
使用2层
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This is the line -->
<item>
<shape>
<solid android:color="#ffffff" />
</shape>
</item>
<!-- This is the main color -->
<item android:bottom="1dp">
<shape>
<solid android:color="#000000" />
</shape>
</item>
</layer-list>
不过,列表视图选择过程中,的TableRow
将不会与的ListView
选择颜色突出显示,因为它的背景已由#000000层接管。
However, during list view selection, the TableRow
will not be highlighted with ListView
selection color, as its background already take over by "#000000" layer.
有没有什么更好的办法我只能有底部边框,但它会服从的ListView
高亮选择什么颜色?
Is there any better way I can have bottom border only, yet it will obey ListView
selection highlight color?
推荐答案
在你的形状文件中使用 [固体机器人:色=@机器人:彩色/透明/&GT;
而不是 [固体机器人:颜色=#00FFFFFF/&GT;
In your shape file use <solid android:color="@android:color/transparent"/>
instead <solid android:color="#00ffffff"/>
这篇关于有它在ListView中用作一行TableLayout底部边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!