title: Menu item with background color
body: <p>I wanted to create a popup menu like following,</p>
  
  <p><a href="https://i.stack.imgur.com/vkwTq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vkwTq.png" alt="enter image description here"></a></p>
  
  <p>I used <code>actionLayout</code> attribute like this, </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &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_1"
          android:title="@string/title"
          app:showAsAction="always"
          android:actionLayout="@layout/item_1" /&gt;
      &lt;item
          android:id="@+id/action_2"
          android:title="@string/title"
          app:showAsAction="always"
          android:actionLayout="@layout/item_2" /&gt;
      &lt;item
          android:id="@+id/action_3"
          android:title="@string/title"
          app:showAsAction="always"
          android:actionLayout="@layout/item_3" /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>where my <code>item_1</code> layout will be like,</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
      android:minWidth="100dp"
      android:padding="5dp"&gt;
  
      &lt;View
          android:id="@+id/view1"
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:background="#fff9c4"
          app:layout_constraintBottom_toBottomOf="@+id/imageTemp"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="@+id/imageTemp" /&gt;
  
      &lt;ImageView
          android:id="@+id/image1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:contentDescription="@string/image"
          android:padding="@dimen/dp8"
          android:src="@drawable/ic_baseline_remove_red_eye_24px"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <p>And I have used this code to create <code>PopupMenu</code>,</p>
  
  <pre><code>PopupMenu popupMenu = new PopupMenu(Objects.requireNonNull(fragment.getActivity()), v);
  popupMenu.getMenuInflater().inflate(R.menu.menu_attachment, popupMenu.getMenu());
  popupMenu.show();
  </code></pre>
  
  <p>But unfortunately I couldn't achieve what I want. The current output is, </p>
  
  <p><a href="https://i.stack.imgur.com/E9Hiy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E9Hiy.png" alt="enter image description here"></a></p>