Thursday, May 2, 2013

Change circle image of radio button android

change circle image of radio button

go to drawable folder and create a xml file named button_radio.xml

paste this in button_radio.xml file


<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/radio_on" android:state_checked="true" android:state_pressed="false"/>
    <item android:drawable="@drawable/radio_off" android:state_checked="false" android:state_pressed="false"/>

</selector>


now downlaod these images radio_off.png , radio_on.png here


put these images in drawable folder

now in Activity file
put


RadioButton rb1;

rb1.setButtonDrawable(R.drawable.button_radio);





No comments:

Post a Comment