gpt4 book ai didi

android - 如何在不使用新图像的情况下减小android中单选按钮上显示的图像的大小

转载 作者:行者123 更新时间:2023-11-29 00:40:25 25 4
gpt4 key购买 nike

我设计了一个 Activity ,其中有两个单选按钮但是这些尺寸已经足够了,我想减少它我使用的文字大小只会减少文字如果布局尺寸减小,则只减小 View 而不是单选按钮圆圈

<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>

最佳答案

为此你可以使用一个选择器

<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>

在radiobutton标签中你可以添加

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

希望对您有所帮助。您可能还想看看这个 link

关于android - 如何在不使用新图像的情况下减小android中单选按钮上显示的图像的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9747773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com