我有当前代码
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:drawable="@drawable/list_button_selected" />
<item
android:state_pressed="true"
android:drawable="@drawable/list_button_pressed" />
<item
android:drawable="@drawable/list_button" />
</selector>
对于我的 CheckedTextView,它有效。但是当它被选中并按下它时,它会显示背景的默认 android 颜色。我怎样才能覆盖它?我试过了
<item
android:state_checked="true"
android:state_pressed="true"
android:drawable="@drawable/list_button_selected" />
但它不起作用。
最佳答案
就我而言,顺序很重要。我必须选中并按下开关,它现在可以正常工作了。
关于android - 在 Android 中为 CheckedTextView 定义可绘制的选中和按下状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9952046/