Sherlock ActionBar Styles
actionbarsherlock, android
Solution
To set the background color to be the same throughout your application, do the following:
In you AndroidManifest add the following style:
< application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.MyTheme"
android:name=".MyApp" >
Then in your styles file add this:
<style name="Theme.MyTheme" parent="Theme.Sherlock.Light">
<item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#ff3399CC</item>
<item name="background">#ff3399CC</item>
</style>
You can then change the color or add any other styles.
Maybe this can help with the logo: https://groups.google.com/forum/?fromgroups#!topic/actionbarsherlock/siirVdZw-ts
Problem
I want to style my action bar to have a background color throughout my application. Currently i use ``` getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_top)) ``` in each of my activities, but i want this to be globally defined. Secondly i don't want the icon in each activity ActionBar. How can this be achieved ? Kind Regards Here is my Style. I want the title to remain but the icon to be hidden ``` <?xml version="1.0" encoding="utf-8"?> ``` ``` <style name="Theme.MyTheme" parent="Theme.Sherlock.Light.DarkActionBar"> <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item> <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item> </style> <style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar"> <item name="android:background">@drawable/bg_top</item> <item name="background">@drawable/bg_top</item> <item name="android:titleTextStyle">@style/Theme.ActionBar.TitleTextStyle</item> <item name="titleTextStyle">@style/Theme.ActionBar.TitleTextStyle</item> <item name="android:displayOptions">useLogo</item> <item name="displayOptions">useLogo</item> </style> <style name="Theme.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title"> <item name="android:textColor">@color/white</item> </style> ```