Reputation: 35928
I have a list view and I want to add a bottom border to each list item so it acts as a separating line between all the cells.
This is my list view right now.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"
android:background="#FFFFFF"
>
....
.....
</LinearLayout>
Upvotes: 1
Views: 5140
Reputation: 17085
Create a drawable
like this , and set it to the list item background
. This will set border only for layout bottom
.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-1dp" android:right="-1dp" android:left="-1dp">
<shape >
<stroke
android:width="1dp"
android:color="#FFFF" />
</shape>
</item>
</layer-list>
or you can also try to set a divider for ListView
android:divider="#FFFF"
android:dividerHeight="1dp"
Upvotes: 0
Reputation: 3392
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/red"
android:dividerHeight="1px">
</ListView>
and color value is inside colors.xml or strings.xml:
<color name="red">#FF0000</color>
P.S. I am using px on purpose check here
Upvotes: 3