我怎样才能改变触摸影响与ActionBarSherlock操作的颜色? [英] How can I change the touch affect color of Actions with ActionBarSherlock?

查看:84
本文介绍了我怎样才能改变触摸影响与ActionBarSherlock操作的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个动作所有这一切都显示正常。当我点击的动作然而,颜色出现为默认偏蓝的颜色,它看起来可怕与我的应用程序。我怎样才能改变行动的选择颜色?

I have several actions all of which display properly. When I click the actions however, the color comes up as the default blueish color and it looks awful with my app. How can I change the 'selected' color of the Action?

这是基本的<一个副本href="http://stackoverflow.com/questions/9019512/how-can-i-change-the-touch-effect-color-of-the-actionbar-in-android-3-0-and-high"><$c$c>this问题 ,除了一个不处理ActionBarSherlock。

This is basically a duplicate of this question, except that one doesn't deal with ActionBarSherlock.

修改

使用公认的答案,我调整后,收到此错误 style.xml

Using the accepted answer, I am getting this error after adjusting style.xml

该错误是错误:错误检索父项:没有资源的发现,是否符合给定的名字'主题'

我进入到我的 style.xml 文件完全按照下面给出。在夏洛特库 /res/values​​/abs_themes.xml 文件的样式名称完全匹配我的。

I entered it into my style.xml file exactly as given below. In the Sherlock library /res/values/abs_themes.xml file the style name matches mine exactly.

推荐答案

那么,这样的ABS用途(几乎)相同的API作为默认的ActionBar所以只是改变(副本)的主题回答:

Well, ABS uses (almost) the same API as the default ActionBar so just change the theme of the (duplicate) answer like this:

<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 属性,但没有机器人:在前面

You just inherit your styles from Theme.Sherlock and set an other selectableItemBackground attribute, but without the android: in front.

这篇关于我怎样才能改变触摸影响与ActionBarSherlock操作的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆