views:

2717

answers:

2

friends,

i want to change color of

android list view seperator line.

any help would be appriciated.

+8  A: 

You can set this value in a layout xml file using android:divider="#FF0000". You should also set/reset the height of the divider when you modify it.

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">

     <ListView 
        android:id="@+id/android:list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:divider="#FFCC00"
            android:dividerHeight="4px"/>

</LinearLayout>
jeremynealbrown
You should also be able to specify a `Drawable` resource in `android:divider` as well. The existing divider is a gradient.
CommonsWare
where is the existing gradient divider?
ninjasense
+1  A: 

Or you can code it:

int[] colors = {0, 0xFFFF0000, 0}; // red for the example
myList.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
myList.setDividerHeight(1);

Hope it helps

Asher Aslan