我有几个 Action 都正确显示。但是,当我单击操作时,颜色显示为默认的蓝色,我的应用程序看起来很糟糕。如何更改操作的“选定”颜色?
这基本上是 this question
的副本, 除了不处理 ActionBarSherlock。
编辑
使用已接受的答案,我在调整 style.xml
后收到此错误
错误是error: Error retrieving parent for item: No resource found that matches given name 'Theme'.
我完全按照下面的方式将其输入到我的 style.xml
文件中。在 Sherlock 库 /res/values/abs_themes.xml
文件中,样式名称与我的完全匹配。
最佳答案
好吧,ABS 使用(几乎)与默认 ActionBar 相同的 API,因此只需像这样更改(重复)答案的主题:
<style name="myStyle" parent="Theme.Sherlock">
<item name="android:selectableItemBackground">@android:drawable/item_background_holo_dark</item>
<item name="selectableItemBackground">@android:drawable/item_background_holo_dark</item>
</style>
和可绘制对象:
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:drawable="@drawable/list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_dark" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_dark" android:state_focused="false" android:state_pressed="true"/>
<item android:drawable="@drawable/list_focused_holo" android:state_focused="true"/>
<item android:drawable="@color/transparent"/>
</selector>
您只需从 Theme.Sherlock
继承您的样式并设置另一个 selectableItemBackground
属性,但前面没有 android:
。
关于android - 如何使用 ActionBarSherlock 更改 Actions 的触摸影响颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14507587/