views:

95

answers:

2

Is there any better way to draw a black horizontal line than defining layout with fixed height and black background?

+1  A: 

The ListView allows you to define a divider drawable. See the android documentation on the ListView for more information.

The Divider will be drawn after each item in your list without the need for you to do anything about it. You can use a drawable or a color as the divider and you can also specify the divider height for the whole list.

Janusz
It works with drawable, but it's not shown when it is a color defined in xml. I read that it's a bug - do you know from which Android version it was fixed?
pixel
I'm developing against 1.6 (SDK Version 4) and it works with xml defined colors. I can post code if you are interested.
slup
My target platform is 1.5 and it doesn't work, so this might suggest that they fixed it in Donut.
pixel
A: 

API Demos List5.java demonstrates including separators, using android.R.layout.simple_expandable_list_item_1

Stephen Denne