根据开放式Android中风?,基本上有两种方法可以为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>
Run Code Online (Sandbox Code Playgroud)

但是,这不是我想要的东西,因为我只想要底边.因此,我尝试了另一种选择.
使用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>
Run Code Online (Sandbox Code Playgroud)

但是,在列表视图选择期间,TableRow不会使用ListView选择颜色突出显示,因为其背景已由"#000000"图层接管.
有没有更好的方法我只有底部边框,但它会服从ListView选择高亮颜色?
小智 1
在你的形状文件中<solid android:color="@android:color/transparent"/>使用<solid android:color="#00ffffff"/>
| 归档时间: |
|
| 查看次数: |
4506 次 |
| 最近记录: |