i am creating an android app in which support level api is 7 so i am using sherlock actionbar. I am using action mode in it. Issue is i want to change the background of action mode. So i have tried
<item name="android:background">@color/something</item>
<item name="android:backgroundStacked">@color/something</item>
<item name="android:backgroundSplit">@color/something</item>
If you are using simple Action Bar then try this,
But if you are using Actionbar share lock Lib then try this
ColorDrawable(0xff123456)
- should be your color code.Drawable/styles.xml
Change Theme as per API level
If you want to change as per the API level then you should go for this
In my case i resolved with this. First i created a style to define the actionModeBackground:
Then i add the style into my base application theme:
Hope it helps!!!
For those who still struggle, and none of the existing solutions helps, please make sure that in your layout with toolbar you have this:
and you don't have
Since they will rise a conflict and your customization will not work.
The simplest way to do it
If you want to do it programmatically (supporting AppCompat) you need to look for icon parent view. This code is tested from 2.3.7 to 6.0.1. You need to check on lower API... .
first get your activity decor view
second set the color in onPrepareActionMode. You can also set the back icon or other elements here
Override this style in your custom theme:
For example: