Change Actionbarsherlock Background Color

Change ActionBarSherlock background color

The action bar background color is defined in a style for the action bar, not in the theme itself. You'll need to do something like this:

<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverflow">
<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">#ff000000</item>
<item name="background">#ff000000</item>
</style>

Be careful using colors defined in XML. ColorDrawable did not respect it's view bounds on pre-Honeycomb so if you use tab navigation with a separate background for the stacked tab view you will have problems.

Change action background color when selected (ActionBarSherlock)

The solution that I found was:

action_item_background.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<solid android:color="#FF0000"/>

</shape>

action_item_background_selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime" >

<item
android:state_pressed="true"
android:drawable="@drawable/action_item_background" />
<item
android:drawable="@android:color/transparent" />

</selector>

styles.xml

 <style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="actionBarItemBackground">@drawable/action_item_background_selector</item>
<item name="android:actionBarItemBackground">@drawable/action_item_background_selector</item>
</style>

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
//...
</style>

Change ActionBarSherlock background color AFTER it has been shown

Just create your background as a drawable xml (or it can be a color if you want a simple color). And then use setBackgroundDrawable(drawable) method.

Look here: How do I make an ActionBar with a background like the YouTube app

and here: ActionBar setBackgroundDrawable() nulling background from Thread/Handler

Change background of the ActionBarSherlock alone. Not the Tabs

Use ActionbarStyleGenerator to change the color of what all you need. This is by far the simplest and most intuitive way.

How to:

  1. Use the UI to select color for different items.
  2. Once done click on download .zip
  3. ZIP would contain resource files under desired folders which you need to copy in your projects res/layout and res/drawableXXXX folders

How to change color of the action bar using actionbarsherlock

ActionBarSherlock version 4.4 does not include the ForceOverflow themes, it was removed in 4.2. You will need to use an older version of ABS to use ForceOverflow as a theme.

As per the Change Log :

Fix: Remove .ForceOverflow themes. These never should have been
included.

If you don't actually need the ForceOverflow, you could use Theme.Sherlock, see the official page for details :

<style name="Theme.MyTheme" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

How To change Background color of Action Bar sherlock Spinner DropDown Dynamically?

Did you try to change your theme ?

In your manifest file, set your theme with the following :

<application
android:theme="@style/Sherlock.__Theme.DarkActionBar">

You can create your own actionbar style easily by using a web generator like Action bar style generator

How to change ActionMode background color in Android

if you want change the color of ActionBar just do this:

 ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable("COLOR"));

see the following link for more info

and if you using ActionMode This is the style used for any ActionMode. You'll need to create your own style to customize it

<style name="Widget.ActionMode">
<item name="android:background">?android:attr/actionModeBackground</item>
<item name="android:backgroundSplit">?android:attr/actionModeSplitBackground</item>
<item name="android:height">?android:attr/actionBarSize</item>
<item name="android:titleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Title</item>
<item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Subtitle</item>
</style>

more info in this site

see this too

Edit

for pre-Honeycomb see this please

maybe this or this helped you

How do I get the default background color in ActionBarSherlock?

Depends on the theme you are using. It should be

  • R.drawable.abs__ab_transparent_dark_holo for Theme.Sherlock
  • R.drawable.abs__ab_solid_light_holo for Theme.Sherlock.Light
  • R.drawable.abs__ab_solid_dark_holo for Theme.Sherlock.Light.DarkActionBar


Related Topics



Leave a reply



Submit