Appcompat-v7 Toolbar menu - highlight color does not affect background text

I configured toolbar

in my application as a dark effects panel and a backlit menu.
All of this seems fine, except for the "selection background" of the menu items.
This is how it looks, notice that there is a light gray background (which appears when clicked) and the background behind the text remains white as if it overrides the onClick color. (general white menu)
enter image description here

Here is the theme used for toolbar

:

<style name="Theme.Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="android:background">@color/primary_color</item>
    <item name="android:textColorPrimary">@color/primary_light</item>
</style>

<style name="Theme.Toolbar.Menu" parent="ThemeOverlay.AppCompat.Light">
    <item name="android:background">@color/primary_light</item>
    <item name="android:textColorPrimary">@color/primary_dark</item>
    <item name="android:selectedWeekBackgroundColor">@color/primary_dark</item>
</style>

      

And the layout toolbar

:

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    app:theme="@style/Theme.Toolbar"
    app:popupTheme="@style/Theme.Toolbar.Menu"/>

      

+3


source to share


1 answer


In your popupTheme, set

<item name="android:colorBackground">@color/your_color</item>



instead of "android: background" (and remove it entirely). I found this solution on this post and it worked for me: appcompat-v7 style of toolbar menu menu

+2


source







All Articles