Eragon20
Eragon20

Reputation: 483

Change internal color of radioButton android

I would like to change the internal color of a RadioButton in android studio. I have tried the android:buttonTint method, but that changes the color of the outer circle on the radio button as well. Is there a way to only change the inside color of a RadioButton, while keeping a black outline?

Upvotes: 1

Views: 567

Answers (1)

rafsanahmad007
rafsanahmad007

Reputation: 23881

in your values/styles.xml:

Add this in your App theme:

 <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        //Green is the color of the pressed state and activated state
        <item name="colorControlActivated">@android:color/holo_green_dark</item>   //add this
        //black is the color of the normal state
        <item name="colorControlNormal">@android:color/black</item>  //Add this
    </style>

Now use the theme in your Activity: in Manifest

<activity
        android:name=".Main_activity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" />

Upvotes: 1

Related Questions