title: Android full screen navigation bar transparency bleeds onto navigation view
body: <p>I'm using design library navigation view in full screen. But transparency of Navigation Bar and Status Bar bleeds onto <code>NavigationView</code>.Transparent black rectangles occur on right and top of the <code>NavigationView</code>.</p>
  
  <p>My Layout</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/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;include
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          layout="@layout/layout_custom_view" /&gt;
  &lt;/RelativeLayout&gt;
  
  &lt;!-- Navigation View --&gt;
  
  &lt;android.support.design.widget.NavigationView
      android:id="@+id/navigation_view"
      android:layout_width="240dp"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      app:headerLayout="@layout/navigation_view_header"
      app:menu="@menu/navigation_menu" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainActivity.java</p>
  
  <pre><code>    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
      if (Build.VERSION.SDK_INT &lt; 16) {
          getWindow().requestFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
      } else {
          hideSystemUI();
      }
      setContentView(R.layout.activity_main);
  
      // Set NavigationView with Header and Menu
      setNavigationView();
  }
  
  /*
   * ************ SETTING FULLSCREEN TRANSIONS ************
   */
  
  /**
   * Hide Status and Navigation bars
   */
  public void hideSystemUI() {
      if (Build.VERSION.SDK_INT &gt;= 16) {
          View decorView = getWindow().getDecorView();
          // Hide both the navigation bar and the status bar.
          // SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and
          // higher, but as
          // a general rule, you should design your app to hide the status bar
          // whenever you
          // hide the navigation bar.
          decorView.setSystemUiVisibility(
                  View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                  // Views can use nav bar space if set
                  | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 
                  | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                  // hide nav bar
                  | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                  // hide status bar
                  | View.SYSTEM_UI_FLAG_FULLSCREEN 
                  | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                  );
      }
  
  }
  
  @Override
  public void onWindowFocusChanged(boolean hasFocus) {
      super.onWindowFocusChanged(hasFocus);
      if (hasFocus) {
          hideSystemUI();
      }
  }
  </code></pre>