Look at this question: How to properly design/style a Android Navigation Drawer
You can add these attributes to the ListView:
android:divider="#FFFFFF"
android:dividerHeight="1dp"
Frage
I've got a navigation drawer where the style of the list items is set to R.layout.drawer_list_item.
mDrawerList.setAdapter ( new ArrayAdapter<String> ( this, R.layout.drawer_list_item, mDrawerTitles ) );
However, it seems the XML that defines the appearance of the list items can only include a single textview. I can't add a view item below the textview, and I can't add a layout. So, how do I add a divider?
List item style:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
Divider:
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
Lösung
Look at this question: How to properly design/style a Android Navigation Drawer
You can add these attributes to the ListView:
android:divider="#FFFFFF"
android:dividerHeight="1dp"
Andere Tipps
Do you Try with a xml that is your style divider. For example
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<gradient
android:angle="0"
android:centerColor="#999999"
android:endColor="#555555"
android:height="1px"
android:startColor="#555555" />
</shape>
</item>
</layer-list>
In your listview (In the XML) use this
<ListView
android:id="@+id/listaFondos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="@drawable/list_divider"
android:dividerHeight="1dip" >
</ListView>
And in your Java Code you can use this
private ListView YourListview;
YourListview = (ListView) findViewById(R.id.YourListview);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.drawer_list_item, mDrawerTitles);
listaFondos.setAdapter(adapter);
drawer_list_item is the xml with your Textview.
I hope help you.
And sorry for my english.