title: Android, DrawerLayout + Fragments + CollapsingToolbarLayout
body: <p>Is it possible to have a CoordinatorLayout / CollapsingToolbarLayout in the fragments shown in the main container of a DrawerLayout?</p>
  
  <p>An answer to another <a href="https://stackoverflow.com/questions/30739806/coordinator-layout-with-toolbar-in-fragments-or-activity">question</a> suggests that each fragment could have its own Toolbar. But this doesn't work well with the <a href="https://developer.android.com/reference/android/support/v7/app/ActionBarDrawerToggle.html#ActionBarDrawerToggle(android.app.Activity,%20android.support.v4.widget.DrawerLayout,%20android.support.v7.widget.Toolbar,%20int,%20int)" rel="nofollow noreferrer"><code>ActionBarDrawerToggle</code></a> as it requires a Toolbar to link to the open/close drawer behaviour.</p>
  
  <p>Has anybody achieved this, or do you have pointers about this? Thanks.</p>
  
  <p><strong>EDIT</strong>: I've been focusing some efforts in putting a single Toolbar in the <code>DrawerLayout</code>, meant to stay there all the time, but was not able to get it to scroll (on a Nexus5 API 22). In <a href="https://stackoverflow.com/questions/30558139/collapsingtoolbarlayout-not-workingcollapsingwhen-scrolled">this question</a> it is mentioned that the <code>CoordinatorLayout</code> needs to be the main view. So maybe inserting it in a DrawerLayout (as below) is not going to work.</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout ...&gt;
  
      &lt;!-- main content --&gt;
      &lt;android.support.design.widget.CoordinatorLayout ...&gt;
  
          &lt;android.support.design.widget.AppBarLayout ...&gt;
  
              &lt;android.support.design.widget.CollapsingToolbarLayout ...&gt;
  
                  &lt;ImageView .../&gt;
  
                  &lt;android.support.v7.widget.Toolbar .../&gt;
  
              &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  
          &lt;/android.support.design.widget.AppBarLayout&gt;
  
          &lt;android.support.v7.widget.RecyclerView .../&gt;
  
      &lt;/android.support.design.widget.CoordinatorLayout&gt;
  
      &lt;!-- navigation drawer --&gt;
      &lt;android.support.design.widget.NavigationView ...&gt;
  
          &lt;!-- drawer content --&gt;
          &lt;fragment .../&gt;
  
      &lt;/android.support.design.widget.NavigationView&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>