how do I change the background of menu items in Android when they are clicked. The problem is sometimes the background is gray (as it should be) and sometimes it's blue.
Thanks in advance.
Edit: Hopefully this will clear things up. I made two screen shots. The first shows the menu on the first click. The second shows the click after I closed the menu and opened again. As you can see the item background is suddenly blue. How do I change that behavior?
Code for menu:
PopupMenu popupMenu = new PopupMenu(getContext(), view);
popupMenu.inflate(R.menu.food_context_menu);
popupMenu.setOnMenuItemClickListener(...);
popupMenu.show();
Menu layout:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_add_to_journal"
android:title="@string/food_action_add_to_journal"
app:showAsAction="withText" />
<item
android:id="@+id/action_edit"
android:title="@string/food_action_edit"
app:showAsAction="withText" />
</menu>
Style:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style>
</resources>