我正在尝试更改操作栏上可操作项的命中状态颜色。在我的 nexus 7 (4.3) 上,命中状态的默认颜色是绿松石蓝色。在我的 nexus 4 (4.4) 上,命中状态是 holo_light。即使在将“android:selectableItemBackground”设置为 holo_light 之后,我在我的 nexus 7 上看到按钮按下时的绿松石蓝色。
这是我正在使用的代码。
<style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">@drawable/bg_image_actionbar</item>
<item name="android:backgroundStacked">@drawable/bg_image_actionbar_stacked</item>
<item name="android:displayOptions">showHome|homeAsUp</item>
<item name="android:icon">@drawable/layer_actionbar_logo</item>
<item name="android:titleTextStyle">@style/ActionBarTitleTextStyle</item>
<item name="android:selectableItemBackground">@drawable/selector_custom_action_bar_selectable_item_bg</item>
</style>
自定义选择器的 xml 是
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_light" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_light" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_light" />
<item android:state_focused="true" android:drawable="@drawable/list_pressed_holo_light" />
<item android:drawable="@android:color/transparent" />
</selector>
有人可以指出我在这里缺少什么吗?