user648462
user648462

Reputation: 665

Android action bar item custom background

I'm using ActionBarSherlock and I'm trying to set a custom background on the action bar items.

I've tried:

    <item name="actionButtonStyle">@style/customActionButtonStyle</item>
    <item name="android:actionButtonStyle">@style/customActionButtonStyle</item>
</style>

<style name="customActionButtonStyle" parent="Widget.Sherlock.Light.ActionButton">
    <item name="android:background">@drawable/background_black_translucent</item>
</style>

and

<item name="android:selectableItemBackground">@drawable/background_black_translucent</item>
<item name="selectableItemBackground">@drawable/background_black_translucent</item>

<item name="android:actionBarItemBackground">@drawable/background_black_translucent</item>
<item name="actionBarItemBackground">@drawable/background_black_translucent</item>

but I can't get it to work. Any ideas?

Thanks

Upvotes: 0

Views: 4753

Answers (1)

user648462
user648462

Reputation: 665

I actually got it to work by setting the selectable item background property:

<style name="MyTheme" parent="@android:style/Theme.Sherlock.Light">
    <item name="android:selectableItemBackground">@drawable/background_action_item</item>
    <item name="selectableItemBackground">@drawable/background_action_item</item>
</style>

Thanks

Upvotes: 3

Related Questions