Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using image in RadioButton instead of text

check image

check text

In Android, I want to use RadioButton, but I do not want to check a plain text. How can I get the display in the first image instead of the second image? Using RadioGroup and RadioButton.

like image 970
chrisTina Avatar asked Dec 14 '22 15:12

chrisTina


1 Answers

Nothing special to do.. just add drawable in it like this:

<RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:drawableLeft="@drawable/ic_launcher"/>

For an effect like this:

enter image description here

RadioButton itself contains a TextView as default.. so you can do all the operations those are present for any TextView.

BONUS: If you want to change the circular dot that shows check status, just update the android:button tag to refer your own drawable.

like image 105
Ankit Bansal Avatar answered Dec 21 '22 10:12

Ankit Bansal