有谁知道如何消除按下的操作栏菜单项周围令人讨厌的蓝色发光?
谢谢,
姆拉乔
是的,您可以覆盖...
android:actionBarItemBackground
...为每个操作项的背景定义可绘制资源。例如。
<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarItemBackground">@drawable/ab_item_background</item>
</style>
检查文档here.
注意:如果您想支持 API 级别低于 14 的 Android 版本,您必须包含支持包 and 动作栏夏洛克(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>
p.s....或者最好,使用状态可绘制:
<?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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)