title: How to change the background of menu items in Android when they are clicked
body: <p>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.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: Hopefully this will clear things up. I made two screen shots. The <a href="http://i.stack.imgur.com/fdOgQ.png" rel="nofollow">first</a> shows the menu on the first click. The <a href="http://i.stack.imgur.com/hd99A.png" rel="nofollow">second</a> 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?</p>
  
  <p>Code for menu:</p>
  
  <pre><code>PopupMenu popupMenu = new PopupMenu(getContext(), view);
  popupMenu.inflate(R.menu.food_context_menu);
  popupMenu.setOnMenuItemClickListener(...);
  popupMenu.show();
  </code></pre>
  
  <p>Menu layout:</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
      &lt;item
          android:id="@+id/action_add_to_journal"
          android:title="@string/food_action_add_to_journal"
          app:showAsAction="withText" /&gt;
      &lt;item
          android:id="@+id/action_edit"
          android:title="@string/food_action_edit"
          app:showAsAction="withText" /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>Style:</p>
  
  <pre><code>&lt;resources&gt;
      &lt;!-- Base application theme. --&gt;
      &lt;style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt;
          &lt;!-- Customize your theme here. --&gt;
          &lt;item name="colorPrimary"&gt;@color/primary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/primary_dark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/accent&lt;/item&gt;
      &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>