How to decrease the size of image displayed on radio button in android without using new image

Trikaldarshiii picture Trikaldarshiii · Mar 17, 2012 · Viewed 9k times · Source

I have designed an activity in which i have two radio button but those size are more than enough i want to decrease it i am using text size that decreases only text if layout size is decrease that decrease only view not radio button circle

<RadioGroup
        android:id="@+id/RG1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <RadioButton
            android:id="@+id/N"
            android:layout_width="wrap_content"
            android:layout_height="30dip"
            android:text="Yes"
            android:textSize="12dip" />

        <RadioButton
            android:id="@+id/Y"
            android:layout_width="wrap_content"
            android:layout_height="30dip"
            android:checked="true"
            android:text="No"
            android:textSize="12dip" />
    </RadioGroup>

Answer

Deva picture Deva · Mar 17, 2012

For this you can use a Selector

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/1" 
    android:state_pressed="true"/>  
<item android:drawable="@drawable/2" 
    android:state_checked="true"/>  
<item android:drawable="@drawable/3" 
    android:state_focused="true" />
<item android:drawable="@drawable/4" />  
</selector> 

and in the radiobutton tag you can add

android:button="@drawable/above"
android:layout_height="20dp"
android:layout_width="wrap_content"

Hope it helpe. You might also want to have a look at this link