title: Android: AppBarLayout gradient background
body: <p>I tried implementing a toolbar with gradient background (from black to transparent). The toolbar is inside an AppBarLayout, which is inside a CoordinatorLayour, because I want the Toolbar to slide off the screen when scrolling the screen (hance the scroll|enterAlways scroll flags). This works perfectly fine for pre-lollipop versions and looks like this: </p>
  
  <p><img src="https://i.stack.imgur.com/b7lM7.png" alt="enter image description here"></p>
  
  <p>But on lollipop this is what is displayed:</p>
  
  <p><img src="https://i.stack.imgur.com/82rke.png" alt="weird upside down trapezoid in the background"></p>
  
  <p>I tried other combinations of backgrounds on the toolbar and appbarlayout to get the toolbar to have the gradient background, but everything produces the same result. I tried searching for similar problems and found none.</p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout
      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="match_parent"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@drawable/gradient"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:layout_height="wrap_content"
              android:layout_width="match_parent"
              android:background="@android:color/transparent"
              app:layout_scrollFlags="scroll|enterAlways"&gt;
  
              ...
  
          &lt;/android.support.v7.widget.Toolbar&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>