Can't change Radio Button color on Android

后端 未结 8 1642
忘了有多久
忘了有多久 2021-01-01 23:52

I\'m using Android Studio. I need to change the color of the Radio Button, after changing the Button Tint Color value to the one I need it works on the preview, but whenever

8条回答
  •  [愿得一人]
    2021-01-02 00:07

    //red is the color of the pressed state and activated state
    @android:color/holo_red_light
    //black is the color of the normal state
    @android:color/black
    

    From: user2968401

    Once you have different styles for the radio button you can swap them by assigning them to a new Radio Button with the style already set to the new style:

    (RadioButton)layout.findViewById(R.id.radioButton) = new RadioButton(this, null, R.style.RadioButton_style);
    

提交回复
热议问题