如何在不使用新图像的情况下减小android中单选按钮上显示的图像的大小 [英] How to decrease the size of image displayed on radio button in android without using new image
本文介绍了如何在不使用新图像的情况下减小android中单选按钮上显示的图像的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设计了一个活动,其中有两个单选按钮 但是那些尺寸足够我要减小它 我正在使用仅减少文本的文本大小 如果减小布局尺寸,则只能缩小视图,而不能缩小单选按钮圆圈
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>
推荐答案
为此,您可以使用选择器
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
这篇关于如何在不使用新图像的情况下减小android中单选按钮上显示的图像的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文