0

我正在使用 ActionBarSherlock 并尝试在操作栏项目上设置自定义背景。

我试过了:

    <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>

<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>

但我无法让它工作。有任何想法吗?

谢谢

4

1 回答 1

3

我实际上是通过设置可选项目背景属性让它工作的:

<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>

谢谢

于 2012-12-10T14:52:49.670 回答