Custom menu item in Toolbar
<p>I'm trying to create a custom layout to my item menu. I need an icon with an image to show a shopping cart like this:</p>

<p><img src="https://i.stack.imgur.com/y8eqQ.png" alt="image"></p>

<p>I create a custom relative layout:</p>

<pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="48dp"
    android:layout_height="fill_parent"
    android:layout_gravity="right" &gt;

    &lt;ImageView
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:clickable="true"
        android:src="@drawable/ic_shopping_cart"/&gt;

    &lt;TextView
        android:id="@+id/counter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:padding="8dp"
        android:text="5"
        android:textSize="15sp"
        android:textColor="#ffffff" /&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>And the item menu:</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/icon_shopping_cart"
        android:actionLayout="@layout/shopping_cart"
        android:title="@string/shopping_icon_description"
        app:showAsAction="always" /&gt;
&lt;/menu&gt;
</code></pre>

<p>Does anyone know how to do it?</p>

<p>Thanks in advance</p>

<p><strong>EDIT:</strong></p>

<p>MainActivity.java</p>

<pre><code>    public class Prueba extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_agroquimicos);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        toolbar.inflateMenu(R.id.shopping_cart);

    }

}
</code></pre>