How to change ActionMode background color in Android
Solution 1:
In my case i resolved with this. First i created a style to define the actionModeBackground:
<style name="MyTheme.ActionMode" parent="@android:style/Theme.Holo.Light">
<item name="android:actionModeBackground">#FFFFFF</item>
</style>
Then i add the style into my base application theme:
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionModeStyle">@style/MyTheme.ActionMode</item>
</style>
Hope it helps!!!
Solution 2:
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
Solution 3:
If you are using simple Action Bar then try this,
ActionBar abar = getActionBar();
abar.setBackgroundDrawable(new ColorDrawable(0xff123456));
But if you are using Actionbar share lock Lib then try this
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff123456));
ColorDrawable(0xff123456)
- should be your color code.
Drawable/styles.xml
<item name="android:actionModeBackground">@drawable/actionbar_background</item>
<item name="actionModeBackground">@drawable/actionbar_background</item>
Change Theme as per API level
If you want to change as per the API level then you should go for this