Selecting a menu item does not change the text background
I have changed the popup themes in my application. But there is a problem. When the user clicks on a menu item, the background of the label does not change, as you can see in the image below.
style:
<style name="PopupTheme" parent="Widget.AppCompat.PopupMenu">
<item name="android:background">@color/primaryDark</item>
<item name="android:textColor">@android:color/white</item></style>
settings menu
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.inflateMenu(R.menu.activity_main); toolbar.setOnMenuItemClickListener(this);
+3
source to share
1 answer
This works for me.
In style xml file
<style name="PopupTheme" parent="Widget.AppCompat">
<item name="android:background">@color/primaryDark</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:drawSelectorOnTop">true</item>
</style>
In the layout xml file
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:popupTheme="@style/PopupTheme" >
+3
source to share