How can I customize the Action Mode's color and text?
The default action mode (3.0 and up) comes with a green theme and a 'Done' button on the left side. How can I customize these?
Thanks
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>
Solution for my application
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionModeBackground">@color/bg_action_bar</item>
</style>
Worked on my project
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="actionModeStyle">@style/CustomActionModeStyle</item>
</style>
Custom ActionMode style
<style name="CustomActionModeStyle" parent="Base.Widget.AppCompat.ActionMode">
<item name="background">@color/color_primary</item>
<item name="titleTextStyle">@style/CustomeActionModeTextStyle</item>
</style>
Custom Title ActionMode
<style name="CustomeActionModeTextStyle" parent="TextAppearance.AppCompat.Widget.ActionMode.Title">
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/color_primaryText</item>
</style>
with this code you can change the Background color of Action mode and also change DONE image. Note: you can add your text in your image too! in res/styles.xml:
<style name="AppTheme" parent="android:Theme.Holo">
<item name="android:actionModeBackground">@android:color/white</item>
<item name="android:actionModeCloseDrawable">@drawable/plus</item>