theXs
theXs

Reputation: 437

ActionBar Sherlock - Backgroundimage in Actionbar

I would love to set a Backgroundimage to the ActionBar which I imported with the "ActionBar Sherlock" library. However I can't find any link on the internet on how to distinctively set an BackgroundImage with XML.

Does anybody here have a hint which he could give me :)?

Upvotes: 3

Views: 3283

Answers (3)

rallat
rallat

Reputation: 1305

In your style.xml file add a custom style like this:

<style name="MyActionBarStyle" parent="Widget.Sherlock.ActionBar.TabBar">
        <item name="android:background">@drawable/actionbar_tab_bg</item>

    </style>

and add this style to your app theme with this to lines, the first for the Android <3.0 and the second for the >3.0

<style name="ReservasAppTheme" parent="@style/Theme.Sherlock.Light">
        <item name="actionBarTabStyle">@style/MyActionBarStyle</item>
        <item name="android:actionBarTabStyle">@style/MyActionBarStyle</item>
        </style>

You should add this style to the application tag in manifest

Upvotes: 2

J.G.Sebring
J.G.Sebring

Reputation: 5964

You create a style for your actionbar, it has to inherit Theme.Sherlock or Theme.Sherlock.Light.

Then link to your image in the attribute abBackground.

Assuming you have an image called myBackgroundImage in res/drawable your style xml would be:

<style name="Actionbar" parent="Theme.Sherlock">
    <item name="abBackground">@drawable/myBackgroundImage</item>
</style>

You can find more attributes for the actionbar here: ActionBarSherlock - Theming

More on styles is found here: Styles and Themes | Android Developers

Upvotes: 6

MikeWallaceDev
MikeWallaceDev

Reputation: 1468

you might want to look at : http://actionbarsherlock.com/theming.html

Upvotes: 0

Related Questions