title: NavigationDrawer height collapses to that of the Toolbar after onPause on some devices
body: <p>I have a fairly simple application that has a custom <code>Toolbar</code> with a <code>NavigationDrawer</code>. Apart from these items I have a <code>GLSurfaceView</code> that fills the entire screen. In my <code>NavigationDrawer</code> I have a list of cases that can be selected and then data is fetched and rendered in the <code>GLSurfaceView</code>.</p>
  
  <p>Everything is working fine, except one thing: When the application is paused and then resumed, the height of the <code>NavigationView</code> collapses to that of the <code>Toolbar</code>. The <code>NavigationView</code> can still be scrolled in that small height and when a case is selected at that point, the <code>NavigationView</code>'s height is refreshed and everything goes back to normal. This therefore also happens on rotation of the device.</p>
  
  <p>Note that if the <code>NavigationView</code> is <em>visible</em> when rotating/pausing the app, the issue <em>does not</em> occur.</p>
  
  <p>This issue does not happen on all devices though. Here is a list I have tested on:</p>
  
  <p>Issue appears on:</p>
  
  <ul>
  <li>Samsung Galaxy S2 Tab: Android 6.0.1</li>
  <li>Samsung Galaxy S7 Edge: Android 6.0.1</li>
  <li>HTC One A9s: Android 6.0</li>
  <li>Samsung Galaxy Note 10.1: Android 5.11</li>
  </ul>
  
  <p>The issue <em>does not</em> appear on:</p>
  
  <ul>
  <li>Sony Xperia XZ: Android 6.0.1</li>
  <li>Huawei Honor 7: Android 5.0.2</li>
  <li>Huawei Nexus P6: Android 7.0</li>
  </ul>
  
  <p>I have tried invalidating all the views in <code>onPause</code>, but nothing helps and I cannot figure out where I am doing something wrong.</p>
  
  <p>Other notes:</p>
  
  <ul>
  <li><code>compileSdkVersion = 25</code></li>
  <li><code>targetSdkVersion = 25</code></li>
  <li>Support library version: <code>25.2.0</code></li>
  <li>Build tools version: <code>25.0.2</code></li>
  <li>Gradle plugin version: <code>2.3.0</code> / Android Studio 2.3</li>
  </ul>
  
  <p><strong>styles.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
  
      &lt;!-- This style is set in AndroidManifest.xml --&gt;
      &lt;style name="DemoTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
  
          &lt;!-- To be able to use a custom Toolbar. --&gt;
          &lt;item name="windowActionBar"&gt;false&lt;/item&gt;
          &lt;item name="windowNoTitle"&gt;true&lt;/item&gt;
  
          &lt;item name="colorPrimary"&gt;@color/demo_color_main_brand&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/demo_color_extras_darkblue&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/demo_color_extras_lightgreen&lt;/item&gt;
  
      &lt;/style&gt;
  
      &lt;style name="DemoActionBarStyle" parent="@style/Widget.AppCompat.ActionBar"&gt;
          &lt;item name="android:theme"&gt;@style/ThemeOverlay.AppCompat.Dark.ActionBar&lt;/item&gt;
          &lt;item name="popupTheme"&gt;@style/ThemeOverlay.AppCompat.Light&lt;/item&gt;
          &lt;item name="android:layout_width"&gt;match_parent&lt;/item&gt;
          &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt;
          &lt;item name="android:background"&gt;@color/demo_color_main_brand&lt;/item&gt;
          &lt;item name="android:minHeight"&gt;?attr/actionBarSize&lt;/item&gt;
      &lt;/style&gt;
  
     ...
  
  &lt;/resources&gt;
  </code></pre>
  
  <p><strong>activity_demo.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/demo_drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;!-- Wrap Toolbar in AppBarLayout to add shadow below the Toolbar. --&gt;
          &lt;android.support.design.widget.AppBarLayout
              android:id="@+id/demo_appbarlayout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/demo_toolbar"
                  style="@style/DemoActionBarStyle" /&gt;
  
          &lt;/android.support.design.widget.AppBarLayout&gt;
  
          &lt;FrameLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_below="@id/demo_appbarlayout" &gt;
  
              &lt;android.support.design.widget.CoordinatorLayout
                  android:id="@+id/fv_coordinatorlayout"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  tools:context=".activities.DemoActivity" &gt;
  
                  &lt;com.my.company.demo.views.DemoGLSurfaceView
                      android:id="@+id/demo_glsurfaceview"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:visibility="visible" /&gt;
  
              &lt;/android.support.design.widget.CoordinatorLayout&gt;
  
          &lt;/FrameLayout&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;android.support.design.widget.NavigationView
          android:id="@+id/demo_navigationview"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          app:headerLayout="@layout/demo_navigationview_header"
          app:menu="@menu/demo_navigationview_menu"
          app:itemIconTint="@drawable/demo_colors_navigationview"
          app:itemTextColor="@drawable/demo_colors_navigationview" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p><strong><code>onCreate</code> in DemoActivity</strong>:</p>
  
  <pre><code>@Override
  protected void onCreate(@Nullable Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_demo);
  
      // Setup Toolbar.
      Toolbar toolbar = (Toolbar) findViewById(R.id.demo_toolbar);
      setSupportActionBar(toolbar);
  
      // Setup NavigationView.
      NavigationView navigationView = (NavigationView) findViewById(R.id.demo_navigationview);
      navigationView.setNavigationItemSelectedListener(this);
  
      // Setup DrawerLayout.
      DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.demo_drawer_layout);
      ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(
              this, drawerLayout, toolbar, R.string.app_name, R.string.app_name);
      drawerLayout.addDrawerListener(actionBarDrawerToggle);
      actionBarDrawerToggle.syncState();
  
      // Load demo cases.
      mModuleConfiguration = new ModuleConfiguration(getString(R.string.module_config_url), this);
  }
  </code></pre>
  
  <p>Before rotation:</p>
  
  <p><a href="https://i.stack.imgur.com/N5epc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N5epc.png" alt="enter image description here"></a></p>
  
  <p>After rotation:</p>
  
  <p><a href="https://i.stack.imgur.com/M9pdv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M9pdv.png" alt="enter image description here"></a></p>