作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我设计了一个 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/
我是一名优秀的程序员,十分优秀!