sr09 sr09 - 18 days ago 5x
Android Question

ListView divider not showing in Android 5

I have a simple listview for which I have defined a custom drawable for the divider. I have defined the divider height to be 1dp. The listview is within a fragment.

android:shape="line" >
android:color="@color/custom_color" />

<gradient android:height="1dp" />


It works great for all Android versions except L.

Anything I'm missing?


You should use android:shape="rectangle" instead of android:shape="line" to make it work on every android version... (also change stroke to solid)

    android:shape="rectangle" >
    <solid android:color="@color/custom_color" />
    <gradient android:height="1dp" />

Have fun!