Toolbar ActionMode seems to ignore my style on devices pre Lollipop.
Here is my style:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:textColorPrimary">#DD000000</item>
<item name="android:textColorSecondary">#8A000000</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
<!-- colorPrimary is used for the default action bar background -->
<!-- Set AppCompat’s color theming attrs -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/secondary</item>
<item name="colorAccent">@color/accent</item>
<item name="android:actionModeStyle">@style/Widget.ActionMode</item>
<item name="android:actionModeBackground">@drawable/toolbar_action_background</item>
<item name="android:actionModeCloseDrawable">@drawable/ic_arrow_back_white_24dp</item>
</style>
<style name="Widget.ActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="android:background">@drawable/toolbar_action_background</item>
<item name="android:titleTextStyle">@style/TitleTextStyle</item>
</style>
<style name="TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#fff</item>
</style>
And my toolbar xml
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:elevation="4dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:background="?attr/colorPrimary" />
I've checked these questions: How to specify dark action mode with my theme Toolbar and Contextual ActionBar with AppCompat-v7 Unable to style action mode when using Toolbar
Expected behaviour, works fine on lollipop:
How it looks on kitkat:
Solved by specifying booth android namspace and without in my theme:
...
<item name="actionModeStyle">@style/ActionMode</item>
<item name="android:actionModeStyle">@style/ActionMode</item>
...
<style name="ActionMode" parent="Widget.AppCompat.ActionMode">
<item name="android:background">@drawable/toolbar_action_background</item>
<item name="background">@drawable/toolbar_action_background</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With