Change color of radio button

Asked

Viewed 1,726 times

3

I have an application that has black background. In one of the screens of the application I have a RadioButton. I need to change the color of this Radiobuttom so that it appears on the screen.

<android.support.v7.widget.AppCompatRadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="New RadioButton"
    android:id="@+id/radioButton"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:buttonTint="#FFF" />

The problem is that in older versions of Android this does not work, IE, the color is not changed. Someone could help me with this?

  • Breno, have you solved your problem with the answer? Or do you need some more information?

1 answer

3


There are several alternatives, one of them is to create a RadioButton customized using two images:

inserir a descrição da imagem aqui inserir a descrição da imagem aqui

So you can create a radio_button_personalizado using them:

radio_button_personalizado.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_checked="true" android:drawable="@drawable/checkedradiobutton" />
     <item android:state_checked="false" android:drawable="@drawable/unchekedradiobutton" />
</selector>

So you can define the android:button as radio_button_personalizado:

Screenshot

inserir a descrição da imagem aqui

Details

  • Great, you helped me out here.

  • @Flaviomisawa managed to solve the problem?!

  • It worked for me yes/ Valewz

Browser other questions tagged

You are not signed in. Login or sign up in order to post.