In styles.xml I'm styling the popup theme of the overflow menu in the toolbar:
<style name="ToolbarOverflowMenuStyle" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:backgroundTint">@color/white</item>
</style>
That works as intended but if I do a multi selection in a recycler view (list) the popup theme background color turns from white to yellow (the color of the toolbar). I have no idea why that is since it has the right color if the multi-selection isn't active.
Any ideas what I am doing wrong?
Styling of the toolbar:
<style name="PostToolbarStyle" parent="android:Theme.Material">
<item name="android:backgroundTint">@color/yellow</item>
<item name="android:textColorHint">@color/lightGray2</item>
<item name="android:textColorPrimary">@color/defaultTextColor</item>
<item name="android:textColorSecondary">@color/defaultTextColor</item>
</style>
And this is how I set the toolbar in the layout xml file:
<android.support.v7.widget.Toolbar
android:id="@+id/app_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize"
android:paddingTop="@dimen/tool_bar_top_padding"
app:popupTheme="@style/ToolbarOverflowMenuStyle"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>
How the popup theme looks like (correctly) when multi-selection is not active:
And here how is being displayed (wrongly) when multi-select is active:
Can you Try editing you style with this property, selectableItemBackground
Had a similar problem with SwitchCompat and the solution was in one of the properties itself. Also this blog helped a lot . http://blog.mohitkanwal.com/blog/2015/03/07/styling-material-toolbar-in-android/
Its Menu -
ActionMode
you see your defaultOptionsMenu
popUp background is the white, and the default contextual Menu for your app is the Yellow in your case. When you enter into multi-selection a ActionMode is triggered to handle the itemClick and what have you, and since you know how CAB works.if you want to maintain the same white background in your
setMultiChoiceModeListener
overrideonPrepareActionMode(ActionMode mode, Menu menu)
and usegetCustomView().setBackgroundColor(Color.White);
Edit: addressing comment
This is what i mean in your
onPrePareActionMode()
Hope its helpful