我无法自定义我的复选框,虽然我已在xml首选项文件中定义了背景,但它不会拉取文件.1.我试图显示复选框的自定义图像,并将选择器xml定义为"android_button.xml",如下所示:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checkable="true"
android:drawable="@drawable/state_normal" /> <!-- pressed -->
<item android:state_checked="true"
android:drawable="@drawable/android_pressed" /> <!-- focused -->
<item android:drawable="@drawable/state_normal" /> <!-- default -->
</selector>
Run Code Online (Sandbox Code Playgroud)
state_normal和android_pressed是res> drawable文件夹中的两个.png图像.
2.my Checkbox preference.xml文件是:
<CheckBoxPreference android:key="@string/Drop_Option"
android:title="Close after call drop"
android:defaultValue="true"
android:background="@drawable/android_button"
/>
Run Code Online (Sandbox Code Playgroud)
定义中是否有任何错误,屏幕上显示的唯一更改是android:title文本,如果我更改文本,则会更改文本.没有别的变化.我该如何解决.谢谢你的建议.