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

大憨熊 提交于 2019-12-01 10:56:20
Deva

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

AliSh

I think this link may be useful for you : Android: How to change the Size of the RadioButton

You probably force to use another picture as their background

this code work for me!

button.getCompoundDrawables();
compoundDrawables[1].setBounds(10, 10, 90, 90);
Sarasranglt

The correct way is to use your custom drawables for radio button's state. To decrease the image size for custom drawables check THIS out.

visit this page http://android-holo-colors.com/ , select Radio and download the output resources (zip file contains a "res" folder), That contains all images for all posible radio button states, replace images with your custom but keeping the size of the download files. If you think it has too much states simply erase from selector in xml drawable theme.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!