有人知道如何消除围绕按下的操作栏菜单项的烦人的蓝色光芒吗?
谢谢,姆拉乔
是的,您可以覆盖...
android:actionBarItemBackground
...为每个操作项的背景定义一个可绘制资源。例如
<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarItemBackground">@drawable/ab_item_background</item>
</style>
在此处查看文档。
注意:如果您想支持 API 级别低于 14 的 Android 版本,您必须在您的应用中包含支持包和ActionBarSherlock (ABS)。之后,您需要为 Android 标准和 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>
除了可绘制对象,您还可以使用颜色,例如:
<item name="actionBarItemBackground">@color/myColorDefinition</item>
ps ...或者最好,使用可绘制的状态:
<?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>