Android toolbar elevation when scrolling
<p>I try to implement a search bar like in google maps android app:</p>

<p><a href="https://i.stack.imgur.com/8CdOml.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8CdOml.png" alt="enter image description here"></a></p>

<p>When the recycler view is in its initial state, the toolbar has no elevation. Only when the users starts scrolling the elevation becomes visible. And the search bar (toolbar) never collapses. Here is what I tried to replicate this:</p>

<pre><code>&lt;android.support.design.widget.CoordinatorLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"&gt;

    &lt;android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" /&gt;

    &lt;android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"&gt;

        &lt;android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="64dp"&gt;

            &lt;!-- content --&gt;

        &lt;/android.support.v7.widget.Toolbar&gt;

    &lt;/android.support.design.widget.AppBarLayout&gt;

&lt;/android.support.design.widget.CoordinatorLayout&gt;
</code></pre>

<p>And here you can see the result:</p>

<p><a href="https://i.stack.imgur.com/bpw6Pl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bpw6Pl.png" alt="enter image description here"></a></p>

<p>So the problem with my solution is, that the elevation of the toolbar is always visible. But I want it to appear only when the recycler view scrolls behind it. Is there anything from the design support library that enables such behavior as seen in the google maps app?</p>

<p>I am using</p>

<pre><code>com.android.support:appcompat-v7:23.2.0
com.android.support:design:23.2.0
</code></pre>