android - Make radiobutton icon smaller -


i'm developing android application , use customize radiobuttons:

<!-- radio button style --> <style name="radiobutton" parent="@android:style/widget.compoundbutton.radiobutton">     <item name="android:button">@drawable/checkbox_unchecked</item> </style> 

but image @drawable/checkbox_unchecked big.

do know how can make smaller?

i know can achieve want reducing size of image. recommend using following code. set images both unselected , selected modes.

this how can achieve it, in few steps: -create image drawables 2 states (checked/unchecked). -create selector 2 drawables. sample content should this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:state_checked="true" android:drawable="@drawable/unchecked" />     <item android:state_checked="false" android:drawable="@drawable/checked" /> </selector> 

-add selector android:button attribute radiobutton

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/background">  <radiobutton      android:id="@+id/radiobutton1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:button="@drawable/checkbox_selector"     android:text="custom radiobutton" />  </linearlayout> 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -