title: Using CoordinatorLayout with TabsLayout in fragments and NavigationDrawer in the enclosing Activity
body: <p>I would like to follow the Google Play navigation design in my application.</p>
  
  <p>I thought it should be pretty straight-forward, but unfortunately Android Studio doesn't offer such a built-in layout. I could not find a detailed example that implements that either. However I found dozens of third-party libraries about that, but the implementation varies too much and it looks like that there is no consensus.</p>
  
  <p>I would like to get a NavigationDrawer whuch opens from the left, and based on what you click on the NavigationDrawer menu, I would also like to have tabbed fragment(Implemented with TabsLayout and ViewPager in the Fragment) on click of the first NavigationDrawer item (under the toolbar).</p>
  
  <p>This is my code:</p>
  
  <p>activity_main.xml</p>
  
  <p>`</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fitsSystemWindows="true"&gt;
  
  &lt;FrameLayout
      android:id="@+id/main_content"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/colorPrimary"
      android:fitsSystemWindows="true" /&gt;
  
  
  &lt;android.support.design.widget.NavigationView
      android:id="@+id/menu_container"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:background="#ffffff"
      android:clickable="true"
      app:headerLayout="@layout/navheader"
      app:itemBackground="?attr/selectableItemBackground"
      app:menu="@menu/menu_navigation" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>fragment1.xml</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:id="@+id/tabanim_maincontent"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.design.widget.AppBarLayout
      android:id="@+id/tabanim_appbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/tabanim_toolbar"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="?attr/colorPrimary"
          app:layout_scrollFlags="scroll|enterAlways"
          app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
  
      &lt;android.support.design.widget.TabLayout
          android:id="@+id/tabanim_tabs"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/tabanim_viewpager"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>