sr09 sr09 - 1 year ago 95
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?

Answer Source

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!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download