繁体   English   中英

Android ActionBarSherlock按下时更改项目的颜色

[英]Android ActionBarSherlock change color of item when pressed

我不明白如何在ActionBarSherlock中更改按下项目的颜色。 我覆盖了Widget.Sherlock.Light.ActionBar.Solid.Inverse主题,当我在寻找该主题的源代码时,找不到按项目时所具有的蓝色。 有人能帮我吗?

有一个样式属性负责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" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM