MainActivity.java
I\'ve implemented MultiChoiceModeListener
in this class and below is the code:
on listView
:
You can change the ActionMode
background through attribute actionModeStyle
:
<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 will of course 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. Example:
<item name="titleTextStyle">...</item>
<item name="subtitleTextStyle">...</item>
<item name="height">...</item>
To change text color of SAVE
and SAVETO
, add the following to AppTheme.Base
:
<item name="actionMenuTextColor">@color/color_action_mode_text</item>
To change the Title Color of contextual action bar this was the only method that worked for me:
Write this in your activity's theme
<item name="actionModeStyle">@style/ContextualActionModeTheme</item>
Define the styles
<style name="ContextualActionModeTheme" parent="@style/Widget.AppCompat.ActionMode">
<item name="titleTextStyle">@style/titleColor</item>
</style>
<style name="titleColor" parent="TextAppearance.AppCompat.Widget.ActionMode.Title">
<item name="android:textColor">@color/your_color_here</item>
</style>
The title color of your contextual action bar would be changed.
use actionModeBackground in your AppTheme.Base style.
<item name="actionModeBackground">@color/colorPrimary </item> (or)
<item name="android:actionModeBackground">@color/colorPrimary </item>