我正在为 Android 开发一个键盘应用程序。我尝试为普通键和功能键设置不同的背景,但它不起作用:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Functional keys. -->
<item android:state_single="true" android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_special" />
<item android:state_single="true"
android:drawable="@drawable/btn_keyboard_special" />
<!-- Toggle keys. Use checkable/checked state. -->
<item android:state_checkable="true" android:state_checked="true" android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_dark_pressed_on" />
<item android:state_checkable="true" android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_dark_pressed_off" />
<item android:state_checkable="true" android:state_checked="true"
android:drawable="@drawable/btn_keyboard_key_dark_normal_on" />
<item android:state_checkable="true"
android:drawable="@drawable/btn_keyboard_key_dark_normal_off" />
<!-- Normal keys -->
<item android:state_pressed="true"
android:drawable="@drawable/glow" />
<item android:drawable="@drawable/btn_keyboard_key_light_normal" />
</selector>