Search code examples
androidxmlspinner

How to change color or drawable of Spinner arrow


Just want to change the color of the Spinner arrow (@color or @drawable)

enter image description here

This is the only code that did something and it make the drawable the entire background of the spinner. (I've tried many other ideas with no luck)

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
...
<item name="android:spinnerStyle">@style/SpinnerColor</item>
</style>

<style name="SpinnerColor" parent="Base.Widget.AppCompat.Spinner">
    <item name="android:background">@drawable/ic_add_white_24dp</item>
</style>

Here is how I am inflating my Spinner

mNavigationSpinner = new Spinner(getSupportActionBar().getThemedContext());
mNavigationSpinner.setAdapter(spinnerAdapter);

mNavigationSpinner.setOnItemSelectedListener(this);
toolbar.addView(mNavigationSpinner);

Solution

  • This is my fix.

    It was a style call in the Toolbar that I had forgotten about.

    In toolbar.xml

    This

    app:theme="@style/ThemeOverlay.AppCompat.Light"
    

    Change to this

    app:theme="@style/ThemeOverlay.AppCompat"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    

    Looks identical to this