Adding Dividers Between Drawer List Items

android, divider, drawer, list, view

Solution

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"

Problem

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"/> ```

Original source