Reputation: 16340
I have a listview:
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@android:id/list"
android:layout_weight="1"
android:divider="@null"
android:dividerHeight="8dp"/>
And I also have a drawable to draw round corners for the listview items:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/listViewItemBackground"/>
<corners android:radius="5dp" />
<padding android:left="3dp" android:top="3dp" android:right="3dp" android:bottom="3dp" />
</shape>
With the above setup, the items are touching each other.
What am I missing?
Upvotes: 0
Views: 40
Reputation: 12362
try like below...
android:divider="@color/redBackground"
and color value is inside colors.xml:
<color name="redBackground">#C60202</color>
Please see below link for more details...
http://developer.android.com/reference/android/widget/ListView.html#attr_android:divider
android:divider
Drawable or color to draw between list items.
May be a reference to another resource, in the form "@[+][package:]type:name"
or to a theme attribute in the form "?[package:][type:]name"
.
May be a color value, in the form of "#rgb"
, "#argb"
, "#rrggbb"
, or "#aarrggbb"
.
This corresponds to the global attribute resource symbol divider.
Upvotes: 1
Reputation: 5166
You've set android:divider="@null"
so obviously you aren't seeing a divider.
Look at how this person has set up their ListView
divider for an example what you should be doing.
Upvotes: 2