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

Zsombor Erdődy-Nagy picture Zsombor Erdődy-Nagy · Jul 2, 2011 · Viewed 32.5k times · Source

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

Answer

adneal picture adneal · Dec 27, 2011

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>