Search code examples
androidandroid-actionbarcontextual-action-bar

Styling the contextual action bar?


i am using orange color theme in ma action bar ,In edit Text when user try to do copy,paste it invokes the contextual action with default blue color background ,it's little weird for users,can i change the background of contextual action bar ?


Solution

  • Try adding this to your style in your styles.xml and use any custom color you would like.

    <item name="android:actionModeBackground">@android:color/holo_orange_light</item>
    

    You can also change the drawables for each icon using similar code.

    android:actionModeCloseDrawable
    android:actionModeCopyDrawable
    android:actionModeCutDrawable
    android:actionModePasteDrawable
    android:actionModeSelectAllDrawable
    

    Credit to the tutorial here - http://www.codercowboy.com/2013/07/05/styling-the-contextual-action-bar-actionmode-divider-or-splitter-for-android/ for changing the contextual action bar icons. Which told me that starting with actionMode changes the contextual action bar attributes