Reputation: 113
I'm trying to change the ugly pink color that radioButton has when on pressed. I've been looking for it but seems like no one has the proper answer on how to do it. Do you recommend me styles or do it programmatically?
This is my xml layout of the radioButtons:
<RadioGroup
android:layout_width="200dp"
android:layout_height="250dp"
android:id="@+id/radioGroup"
android:orientation="vertical"
android:layout_above="@+id/btSig"
android:layout_centerHorizontal="true">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:id="@+id/primero"
android:layout_marginTop="10dp"
android:onClick="pulsado"
android:textSize="17dp"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:id="@+id/segundo"
android:layout_marginTop="10dp"
android:onClick="pulsado"
android:textSize="17dp"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:id="@+id/tercero"
android:layout_marginTop="10dp"
android:onClick="pulsado"
android:textSize="17dp"
/>
</RadioGroup>
Upvotes: 0
Views: 1009
Reputation: 749
The simplest way to change the default RadioButton color app-wide is to change it in your res
folder.
In your project, go to app
>res
>values
>colors.xml
. This XML file contains the colors for your app in HEX values.
You will most likely see three XML values under <resources>
. Remember, the colorAccent value changes the RadioButton select color.
Upvotes: 0
Reputation: 262
You can change it with like that android:buttonTint="#a14545"
Code Example
<RadioButton
android:id="@+id/rb_mini_layout_selection_word_types_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:checked="true"
android:text="all"
android:buttonTint="#a14545" />
Upvotes: 1