Remove pressed effect on action bar home icon

对着背影说爱祢 提交于 2019-12-05 06:29:56

问题


First, a few words about the app : minimum level is 16, I use a DrawerLayout (with the indicator) and have changed the background of my ActionBar.

When clicking on the home button to open the drawer, there is a blue pressed effect on both the image and the drawer indicator, that I'd like to remove. I tried setting selectableItemBackground in the styles to transparent, nearly everywhere I could think of, but that doesn't seem to change anything. Do anyone have a solution ?

Here is the image of this effect I'd like to remove :

Here is the styles.xml part for the ActionBar I'm using :

<style name="ActionBar.Solid.Bnp" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@drawable/action_bar_green</item>
    <item name="android:titleTextStyle">@style/ActionBar.Title</item>
    <item name="android:actionBarItemBackground">@null</item>
</style>

and finally the drawable used for background.


回答1:


selectableItemBackground is close, but you need to use the actionBarItemBackground attribute instead.

For instance:

<style name="Your.Theme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarItemBackground">@null</item>
</style>

You should keep in mind that the system uses this attribute in the ActivityChooserView too, which is what the ShareActionProvider returns in ActionProvider.onCreateActionView.

To highlight all this, here are the results when you use @android:color/holo_red_light instead:



来源:https://stackoverflow.com/questions/23369749/remove-pressed-effect-on-action-bar-home-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!