Android 使单选按钮图标变小

Android 使单选按钮图标变小,android,Android,我正在开发一个Android应用程序,我使用它来定制单选按钮: <!-- Radio button style --> <style name="RadioButton" parent="@android:style/Widget.CompoundButton.RadioButton"> <item name="android:button">@drawable/checkbox_unchecked</item> </style>

我正在开发一个Android应用程序,我使用它来定制单选按钮:

<!-- Radio button style -->
<style name="RadioButton" parent="@android:style/Widget.CompoundButton.RadioButton">
    <item name="android:button">@drawable/checkbox_unchecked</item>
</style>

@可绘图/复选框未选中
但是图像
@drawable/checkbox\u unchecked
非常大


你知道我怎样才能把它缩小吗?我知道你可以通过缩小图像的大小来实现你想要的。但我建议使用以下代码。这将帮助您为未选择的和选定的模式设置图像

通过以下几个步骤,您可以实现这一目标: -为其两种状态(选中/未选中)创建
图像可绘制项
。 -为这两个绘图项创建选择器。示例内容应如下所示:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@drawable/unchecked" />
    <item android:state_checked="false" android:drawable="@drawable/checked" />
</selector>

您可以减小图像的大小-这也会减小应用程序的大小,这总是好的。@BenjaminSchwalb感谢您的评论。哪个尺寸适合图标?我会尝试使用100x100像素,如果必要的话进一步缩小它-如果你的单选按钮有固定的尺寸,你也可以缩小它并在代码中更改大小。(不过,不要使用太大的文件)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background">

<RadioButton 
    android:id="@+id/radioButton1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:button="@drawable/checkbox_selector"
    android:text="Custom RadioButton" />

</LinearLayout>