I\'m trying to create a theme for my first Android app, and it is driving me round the bend. I finally managed to figure out how to style items in a dropdown list, but now I
The style method in the accepted answer works well until you need two spinners with different divider colors.
Here is what I found works as an alternative:
a) Set the popupBackgroundColor attribute on the spinner to the color you want for the divider. This will color the entire list item's background (including the space we think of as the divider).
b) Set the spinners adapters dropDownViewResource to be a CheckedTextView with it's background attribute set to some other color (or a selector if you want the selected items to have a different color). This will override the color we set in step a for everything but the divider. effectively giving us the desired result.
So you will have:
drawable/spinner_dropdown_background_selector:
layout/drop_down_item.xml:
Your spinner definition:
And finally your array adapter definition:
ArrayAdapter dataAdapter = new ...
dataAdapter.setDropDownViewResource(android.R.layout.drop_down_item);
spinner.setAdapter(dataAdapter);
Please note that setting the popupBackgroundColor has no effect if the spinner is in dialog mode.