我不明白如何在ActionBarSherlock中更改按下的项目的颜色。我正在覆盖主题Widget.Sherlock.Light.ActionBar.Solid.Inverse
,当我看到这个主题的来源时,我找不到我的项目按下时的蓝色。
有人能帮助我吗?
答案 0 :(得分:1)
有一个样式属性负责ActionButton背景: actionBarItemBackground 。只需将您自己定义的DrawableStateList设置为值即可。
例如,这是默认的DrawableStateList:
<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/abs__list_selector_disabled_holo_dark" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/abs__list_selector_disabled_holo_dark" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_background_transition_holo_dark" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_background_transition_holo_dark" />
<item android:state_focused="true" android:drawable="@drawable/abs__list_focused_holo" />
<item android:drawable="@android:color/transparent" />