我创建了一个自定义复选框drawable:
我创建了两张可绘制的图片(一张为未选中状态,一张为选中状态),每个尺寸都有一张(
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="false"
android:drawable="@drawable/ic_checkbox_unchecked" />
<item
android:state_checked="true"
android:drawable="@drawable/ic_checkbox_checked" />
<item
android:drawable="@drawable/ic_checkbox_unchecked" />
</selector>
我使用它的方式如下:
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:button="@drawable/checkbox"
/>
我创建了两张可绘制的图片(一张为未选中状态,一张为选中状态),每个尺寸都有一张(
xxxhdpi
,xxhdpi
等)。
然而,我的复选框显示如下:
为什么它这么大?如何将其缩小到20x20dp?
xxxhdpi
、xxhdpi
等)创建了一个可绘制的文件。复选框应该有多大? - user5495265ic_checkbox_unchecked
图像。 - Syed Qasim Ahmed