问题
I am creating an actionbar with custom looking buttons that I put in the icon section of menu.xml.
The problem is that, when I press them, I see both the selected version of the image of the button and the blue background of the holo theme.
This is my menu.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/current_position"
android:icon="@drawable/ab_location_layer"
android:menuCategory="container"
android:showAsAction="ifRoom"
android:title="Current position">
</item>
</menu>
The ab_location_layer is this:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ab_location_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/ab_location" android:state_pressed="false"/>
</selector>
The ab_location_layer contains an image that is smaller than the actionBar. How is possible to remove the blue background on actionbar? I am also using actionbarsherlock.
Thanks
回答1:
I found the answer on ActionBarSherlock Mailing List:
you have to put this
<item name="android:selectableItemBackground">@null</item>
<item name="android:actionBarItemBackground">@null</item>
<item name="actionBarItemBackground">@null</item>
to your theme and not in ActionBar theme
来源:https://stackoverflow.com/questions/9923364/remove-actionbar-item-blue-background