Actionbar button background

こ雲淡風輕ζ 提交于 2020-01-12 03:33:06

问题


I want to customize actionbar buttons with an image both for pressed and not pressed state. I put a drawable selector on android:icon with two states (pressed and not pressed). The problem is that, if I press the button, I still have the blue background (ics holo style) along with my pressed button icon. How can I remove this behaviour from actionbar customized icon buttons?

Thanks


回答1:


I think the more specific way is to put this attribute in your application Theme:

    <item name="android:actionBarItemBackground">@android:color/transparent</item>

Also put this if you're using ActionBarSherlock:

    <item name="actionBarItemBackground">@android:color/transparent</item>



回答2:


I have fixed the problem putting

 <item name="android:selectableItemBackground">@color/transparent</item>

in styles.xml. I thought it would have affected all the select styles but it seems it affects just the actionbar.



来源:https://stackoverflow.com/questions/9285068/actionbar-button-background

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