According to Open-sided Android stroke?, there are basically 2 ways to implement borders for TableLayout.
Use Stroke
<?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.
Use 2 layers
<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>
However, during list view selection, the TableRow
will not be highlighted with ListView
selection color, as its background already take over by "#000000" layer.
Is there any better way I can have bottom border only, yet it will obey ListView
selection highlight color?