0

When I start ActionMode (I make this when I set items in ListView) my ToolBar change background color from dark to white and I got this:

enter image description here

How you can see - it's looked bad.

How I can change ToolBar background color when ActionMode is activated?

Artem
  • 4,569
  • 12
  • 44
  • 86

1 Answers1

1

Change the ActionMode background with use of actionModeStyle attribute

<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
....
....
<item name="actionModeStyle">@style/LStyled.ActionMode</item>
</style>

<style name="LStyled.ActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="background">@color/color_action_mode_bg</item>
</style>

You need to define a color named color_action_mode_bg:

<color name="color_action_mode_bg">#009688</color>

There are other things you can change as well. e.g:

<item name="titleTextStyle">...</item>
<item name="subtitleTextStyle">...</item>
<item name="height">...</item>

To change text color of text Citroen add the following to AppTheme.Base:

<item name="actionMenuTextColor">@color/color_action_mode_text</item>

Updated Code

<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>
Kishan Soni
  • 816
  • 1
  • 6
  • 19
  • and if you using ActionMode This is the style used for any ActionMode. You'll need to create your own style to customize it so try my updated code – Kishan Soni Dec 21 '15 at 11:29
  • http://dl1.joxi.net/drive/0004/0191/303295/151221/7f4e93d1d2.jpg - I must extend this? – Artem Dec 21 '15 at 11:38