0

ActionBarSherlockスタイルをオーバーライドするのに問題があるので、誰かが助けてくれることを願っています。私は次のようなドローアブルを作成しました:

(res / drawable / actionbar_background.xml内)

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/bg"
    android:tileMode="repeat" />

次に、私のアプリのスタイルファイル(res / values / style.xml)にあります

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="ActionBar" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:background">@drawable/actionbar_background</item>
</style>
<style name="my_theme" parent="@style/Theme.Sherlock.Light">
        <item name="android:actionBarStyle">@style/ActionBar</item>
    </style>
</resources>

その結果、Theme.Sherlock.Lightスタイルが選択されます(または、交換した場合はTheme.Sherlock)が、アクションバーの背景自体にスタイルの変更はありません。

ありがとう

4

2 に答える 2

12

This should give you the Theme.Sherlock.Light style with your custom action bar background:

<style name="ActionBar" parent="Theme.Sherlock.Light">
    <item name="abBackground">@drawable/actionbar_background</item>
</style>

Put it in your res/values/style.xml file and declare your style to be @style/ActionBar in your manifest.

More info - http://actionbarsherlock.com/theming.html

于 2012-02-06T15:16:25.090 に答える
6

バージョン4.0以降では、単に「背景」アイテム名を使用できます。

<style name="ActionBar" parent="Theme.Sherlock.Light">
    <item name="background">@drawable/actionbar_background</item>
</style>
于 2012-03-31T01:32:29.103 に答える