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 に答える