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

标签 android android-layout android-2.1-eclair

我设计了一个 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> 

并在单选按钮标记中添加

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

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

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

相关文章:

android - osmdroid :Resource not found: marker_default. png

android - 如何在Here Map中实现当前位置蓝色图标

android - 在textview中更改可绘制图像的重力

java - 选项卡式 Activity 中 fragment 之间的交互

css - Android 2.1 浏览器不加载移动网站的 css

jquery - 在 Android/jQuery 移动应用程序中保存凭据

android - jBox2d android 绘制动态物体

android - ScrollView 不滚动?

linux-kernel - 如何为真正的 Android 手机编译 Linux 内核?