title: Android support Toolbar not displaying custom drawable properly
body: <p>I'm trying to update my apps ActionBar into toolbar but I encountered some problem on customizing my Toolbar to display a custom drawable. </p>
  
  <p>What I tried so far is to set my xml drawable into the Toolbar but it destroys the whole toolbar and moved the menu button down where I cannot properly see it:</p>
  
  <p>Here's the drawable first:</p>
  
  <p><strong>bg_actionbar.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;layer-list
      xmlns:android="http://schemas.android.com/apk/res/android" &gt;
      &lt;item android:drawable="@drawable/bg_gradient" /&gt;
      &lt;item android:drawable="@drawable/icon_logo" /&gt;
  
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>bg_gradient is just a 9patch image gradient and same with the icon_logo.</p>
  
  <p>And for my toolbar:</p>
  
  <pre><code>&lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:id="@+id/actionBar"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="@drawable/bg_actionbar"
          app:contentInsetEnd="0dp"
          app:contentInsetStart="0dp"&gt;
  
  
      &lt;/android.support.v7.widget.Toolbar&gt;
  </code></pre>
  
  <p>this one pushes my menu button below and has a spacing of about 300dp on left with the icon shrinked in height.</p>
  
  <p>Now I just tried to directly changed the background straight into just the png image (bg_gradient) and same thing happens. I've also tried adding an ImageView inside the Toolbar but same thing it just destroys the whole ToolBar and once again I'm lost on how I can customize this Toolbar further. Anyone has the idea? TIA.</p>
  
  <p>UPDATE:</p>
  
  <p>I tried adding a linear layout on the toolbar to contain the background but still it doesn't display properly on my end:</p>
  
  <pre><code>&lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:id="@+id/actionBar"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="@color/cherry_red"
          app:contentInsetEnd="0dp"
          app:contentInsetStart="0dp"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@drawable/bg_actionbar"/&gt;
  
      &lt;/android.support.v7.widget.Toolbar&gt;
  </code></pre>
  
  <p>Here's what happened:</p>
  
  <p><img src="https://i.stack.imgur.com/XsjX8.png" alt="enter image description here"></p>
  
  <p>Additionally here's what I expected it to be:</p>
  
  <p><img src="https://i.stack.imgur.com/3kfzj.png" alt="enter image description here"></p>
  
  <p>Icon should be on center, and 9patch image as gradient since I'm having trouble on XML to have a percentage on the start mid and end colors and the navigationIcon should be on top of the gradient.</p>