Styling the Contextual Action Bar ActionMode Divider or Splitter for Android

My coworker and I spent a good deal of time this morning attempting to change the style / color of the Android ActionBar’s Contextual Action Bar divider between the checkmark action button and the rest of the bar. You see this divider or splitter in the image below on the right side of the red boxed area:

We had trouble finding the answer because the ActionBar is a complex beast with N embedded widgets or modes and unclear terminology / documentation regarding this particular issue. The Contextual Action Bar’s ActionMode view is subtly different from a normal ActionBar and has its own limited subset of differently-named styles.

Many searches, blog posts, and stack overflow threads later, we finally found the right terminology for this, the button is not a normal ActionButton as far as styling is concerend – the button is called the Close Button, and the related styles are android:actionModeCloseDrawable and android:actionModeCloseButtonStyle.

Heres how we overrode those styles in our app:

  1. <style name="AppTheme" parent="AppBaseTheme">
  2.         <!– All customizations that are NOT specific to a particular API-level can go here. –>
  3.         <!– ABS attributes (required for backwards compatibility: http://actionbarsherlock.com/theming.html) –>
  4.         <item name="actionModeCloseDrawable">@drawable/ic_cab_done_holo_dark</item>
  5.         <item name="actionModeCloseButtonStyle">@style/Widget.Sherlock.ActionButton.CloseMode</item>
  6.  
  7.         <!– Android SDK attributes –>
  8.         <item name="android:actionModeCloseDrawable">@drawable/ic_cab_done_holo_dark</item>
  9.         <item name="android:actionModeCloseButtonStyle">@style/Widget.Sherlock.ActionButton.CloseMode</item>
  10. </style>

Related stack overflow threads: