How to Change Actionmode Background Color in Android

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

Having trouble changing the ActionMode background color in Android

OK so I solved this by simply doing this:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/paletteLightBlue3</item>
<item name="colorPrimaryDark">@color/dark_grey</item>
<item name="colorAccent">@color/paletteLightBlue</item>
<item name="android:actionModeBackground">@color/dark_red</item>
</style>

I just put set the actionModeBackground in my AppTheme, instead of a separate style. Simple.

Android ActionMode title background color

I ran into this issue using the the AppBarLayout with the Toolbar and TabLayout. I had set the background color on the Toolbar and that caused the ActionMode title to display the background color of the Toolbar and not the actionModeBackground color that was set on the Theme.

I moved the background color to the AppBarLayout instead and this fixed the issue with the title having the background color of the Toolbar.

Hope this helps someone!

How can I change text/icon color in Action Mode?

Use following snippet to change ActionMode background color + Title Color + Back Button Color

styles.xml

<style name="ActionModeStyle" parent="@style/Widget.AppCompat.ActionMode">
<item name="background">@color/colorPrimary</item>
<item name="titleTextStyle">@style/ActionModeTitleTextStyle</item>
</style>

<style name="ActionModeTitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionMode.Title">
<item name="android:textColor">@android:color/white</item>
</style>

themes.xml

<item name="actionModeStyle">@style/ActionModeStyle</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>

Please Note: actionBarTheme will be responsible for setting back
button color to white.

How can I customize the Action Mode's color and text?

This is the style used for any ActionMode, I pulled it from the SDK. You'll need to create your own style to customize it. It's really easy to do. If you've never done anything like this before, you should read through this post on customizing the ActionBar. It explains everything you'll need to know.

    <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>

Change background color of ActionMode

I found the solution by using getActivity() function for AppCompactActivity.



Related Topics



Leave a reply



Submit