Answer the question
In order to leave comments, you need to log in
How to change color of RadioButton using selector?
Hello!
There are several radio groups in them there is a radio button. When you click on the radio button, the size of the button and its color change. I implemented the change of size and color, but there was a bug. When you click on several radio batans in a row, the next one can only change the size, but not the color.
pictures
step 1
step 2
step 3
How to enter RB 1.1 only changes size but not color
selector code
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" >
<shape android:shape="rectangle" >
<stroke android:width="1dip" android:color="@color/btn_yellow" />
<solid android:color="@color/btn_yellow" />
</shape>
</item>
<item android:state_checked="true">
<shape android:shape="rectangle" >
<stroke android:width="1dip" android:color="@color/btn_yellow" />
<solid android:color="@color/btn_yellow" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<stroke android:width="1dip" android:color="@color/grey" />
<solid android:color="@color/grey" />
</shape>
</item>
</selector>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question