How to show divider between spinner items?

RickardP picture RickardP · Dec 31, 2010 · Viewed 32.8k times · Source

I using listviews and expandedviews that has dividers and I can set them but on spinner its looks like it is no divider between items.

Someone that has a idea of how to fix this?

Answer

X09 picture X09 · Jul 26, 2016

This worked for me:

<style name="SpinnerStyle" parent="Widget.AppCompat.ListView.DropDown">
        <item name="android:divider">#d1d1d1</item>
        <item name="android:dividerHeight">0.5dp</item>
    </style>

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="android:dropDownListViewStyle">@style/SpinnerStyle</item>

The advantage of using this is that it doesn't remove the ripple effect on hover.