Home » Android » Android – Customizing the Spinner widget Look and Feel

Android – Customizing the Spinner widget Look and Feel

Posted by: admin June 15, 2020 Leave a comment


Is it possible to change the color of the radio button in the Android spinner widget. By default it displays the green color for the radio button.

I need to change it to some other color, is it possible, and how?

How to&Answers:

I know this is an old question now, but here goes…

You will need to create a custom Theme and apply it to the Activity with your spinner.

First, you need to create images for the checked/unchecked states of the ‘new’ radio, you could just pull the given images btn_radio_on.png and btn_radio_off.png from the sdk’s res/drawable-* folder(s). Edit them to look how you want (such as changing color or whatever) and save off to your project.

Next, create a new xml file in your res/values folder, and add the following:

    <style name="CustomSpinnerRadioTheme" parent="@android:style/Theme">
        <item name="android:spinnerDropDownItemStyle">@style/EditedRadio</item>

    <style name="EditedRadio" parent="@android:style/Widget.DropDownItem.Spinner">
        <item name="android:checkMark">@drawable/edited_radio</item>

Then, create another xml file in res/drawable named edited_radio.xml, and it should contain the following:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="false" android:drawable="@drawable/btn_radio_off" />
    <item android:state_checked="true" android:drawable="@drawable/btn_radio_on" />

just be sure to reference your edited images for the checked states. Then you just have to apply the CustomSpinnerRadioTheme to your Activity and run!

A good resource I found is Applying Styles and Themes especially the additional reference on Android Styles (styles.xml) and Android Themes (themes.xml)