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 :)?
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
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
你可能想看看: http : //actionbarsherlock.com/theming.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.