0

I am creating radio button in android application but i want to make it customized. But i don't know how to do it. I want image as icon and text under the icon as in this image shown.Also i want to change the color whenever any radiobutton is selected.

enter image description here

This type of radio button i want. Please tell me how can i make it ?

Geetika Sachdeva
  • 103
  • 2
  • 10

1 Answers1

0

You Can use Custom Background

<RadioButton
   android:id="@+id/radioButtom"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:background="@null"
   android:button="@drawable/custom_background"
   android:checked="true"
   android:text="Your Text" />

Here is Custom_background.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
    android:drawable="@drawable/your_regular_state_drawable"
    android:state_checked="true"
    android:state_pressed="true" />
<item
    android:drawable="@drawable/your_selected_state_drawable"
    android:state_pressed="true" />
<item
    android:drawable="@drawable/your_selected_state_drawable"
    android:state_checked="true" />
<item
    android:drawable="@drawable/your_regular_state_drawable" />

Referance: You can get e better description from here https://stackoverflow.com/a/19163987/12676247

Jyotish Biswas
  • 674
  • 5
  • 11