如何从夏洛特动作栏菜单项的蓝色辉光? [英] How to remove blue glow from Sherlock action bar menu item?
问题描述
有谁知道如何删除这个恼人的蓝色辉光环绕的是pressed动作栏菜单项?
Does anybody know how to remove this annoying blue glow that surrounds action bar menu item that is pressed?
谢谢, Mladjo
Thanks, Mladjo
推荐答案
是的,你可以覆盖...
Yes, you can overwrite ...
android:actionBarItemBackground
...,定义了每个动作项目的背景绘制资源。例如,
... that defines a drawable resource for each action item's background. E.g.
<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarItemBackground">@drawable/ab_item_background</item>
</style>
这里检查文档。
Check the documentation here.
请注意:如果你想支持的Android版本,API级别小于14,你必须包含的支持包和 ActionBarSherlock (ABS)在你的应用程序。然后你需要设置背景为 - Android的标准和ABS:
Note: if you want to support Android versions with API level less than 14 you have to include the support package and ActionBarSherlock (ABS) in your app. Afterwards you need to set the background for both - Android standard and ABS:
<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarItemBackground">@drawable/ab_item_background</item>
<item name="actionBarItemBackground">@drawable/ab_item_background</item>
</style>
而不是一个可拉伸的,你也可以使用一个颜色,例如:
Instead of a drawable you could also use a color, e.g.:
<item name="actionBarItemBackground">@color/myColorDefinition</item>
PS ...或者最好使用状态绘制:
p.s. ... or best, use a state drawable:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_pressed"
android:state_pressed="true" />
<item android:drawable="@drawable/button_default" />
</selector>
这篇关于如何从夏洛特动作栏菜单项的蓝色辉光?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!