I have set
<item name="android:spinnerMode">dialog</item>
and so when I tap the spinner, I get a popup. But that popup is grey with white text and I can't seem to change any of the colors. How do I style this dialog?
I tried the following with some crazy temporary colors to see what changes but nothing changes.
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:dialogTheme">@style/SpinnerDialog</item>
<item name="android:alertDialogTheme">@style/SpinnerAlertDialog</item>
</style>
<style name="SpinnerDialog" parent="Theme.AppCompat.Light.Dialog">
<item name="android:popupBackground">#ff00ff</item>
<item name="colorPrimary">#ff00ff</item>
<item name="colorPrimaryDark">#ffff00</item>
<item name="colorAccent">#ff0000</item>
</style>
<style name="SpinnerAlertDialog" parent="Theme.AppCompat.Dialog">
<item name="colorPrimary">#00ffff</item>
<item name="colorPrimaryDark">#00ff00</item>
<item name="colorAccent">#0000ff</item>
</style>
There are a bunch of similar questions, but they all either deal with dropdowns or ancient versions of Android or just don't work.
Android Spinner is a view similar to the dropdown list which is used to select one option from the list of options. It provides an easy way to select one item from the list of items and it shows a dropdown list of all values when we click on it.
Android Spinner class is the subclass of AsbSpinner class.
Instead of using theme or style.xml for changing the popup background color of dialog.
Why not try this?? In your layout xml
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:spinnerMode="dialog"
android:popupBackground="#yourcolor"/>
Since you tried adding theme it changes nothing.This will be easy to achieve..isn't it??
Hope this helps!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With