改变radioButton android的内部颜色

时间:2017-03-24 18:54:14

标签: android colors radio-button

我想在android studio中更改RadioButton的内部颜色。我尝试了android:buttonTint方法,但也改变了单选按钮上外圈的颜色。有没有办法只改变RadioButton的内部颜色,同时保持黑色轮廓?

1 个答案:

答案 0 :(得分:1)

在您的values / styles.xml中:

在您的应用主题中添加此内容:

 <!-- 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>

现在使用Activity中的主题:in Manifest

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