Reputation: 757
I'm building an Android app with AppCompat Theme but I have a problem to set my ActionMode theme in my app. I'm trying to add a new style for this but it seems override the main actionbar and I don't know why...
This is the main Actionbar:
When I try to copy a text...
This is my actionbar layout:
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:theme="@style/ActionBarThemeOverlay"
app:popupTheme="@style/PopupMenuStyle">
And finally, this is my style.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:textColorPrimary">#808080</item>
<item name="windowActionModeOverlay">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:spinnerItemStyle">@style/Spinner.spnItem</item>
<item name="android:spinnerDropDownItemStyle">@style/Spinner.spnItemDropDown</item>
<item name="colorAccent">@color/primarycolor</item>
<item name="actionModeStyle">@style/ActionModeStyle</item>
</style>
<style name="ActionBarThemeOverlay" parent="ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="colorControlNormal">#fff</item>
<item name="colorControlHighlight">#fff</item>
<item name="android:background">@color/primarycolor</item>
</style>
<style name="PopupMenuStyle">
<item name="android:background">@color/white</item>
<item name="android:popupBackground">@color/white</item>
<item name="android:textColorPrimary">@android:color/black</item>
</style>
<style name="ActionModeStyle">
<item name="android:colorBackground">@color/primarycolor</item>
</style>
I'm loosing my mind...
What am I doing wrong?
Thanks!
Upvotes: 0
Views: 1988
Reputation: 7109
Try to use this for "ActionModeStyle", should work:
<style name="ActionModeStyle" parent="@style/Widget.AppCompat.ActionMode">
<item name="background">@color/primarycolor</item>
</style>
Instead of "android:colorBackground> you should use only "background". And I think it is better to define an parent.
Upvotes: 2