title: Lollipop navigation bar overlapping Dialog with Gravity.Bottom
body: <p>I'm following the technique outlined <a href="https://stackoverflow.com/questions/9467026/changing-position-of-the-dialog-on-screen-android/9467151#9467151">here</a> in order to have my Dialog float to the bottom of the screen and take up the full width, similar to a drawer. This works on every version of Android that I'm targeting (16+) except for Lollipop. The Dialog will float behind the software navigation buttons (back, home and stack), making it impossible to press the negative or positive buttons on my dialogs. </p>
  
  <p>I've tried the method outlined <a href="https://stackoverflow.com/questions/27723322/bottom-soft-navigationbar-overlaps-my-listview">here</a> but was unsuccessful. I've considered adding a bottom padding to all of my dialogs - but this means I'll have to set custom views instead of using the alertdialog builders other methods. I think there may be a way to avoid this that I am not finding.</p>
  
  <p>EDIT 1:</p>
  
  <p>I've tried the setSystemUiVisibility method now, by disabling the flags for fullscreen, immersive and hide navigation. However the dialog, when created, still sits behind the navigation buttons on the screen (tested in API 22). I've also tried </p>
  
  <pre><code>decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
  </code></pre>
  
  <p>Here is my current code:</p>
  
  <pre><code>@Override
  public void onStart()
  {
      super.onStart();
  
      AlertDialog dlg = (AlertDialog) getDialog();
  
      Window window = dlg.getWindow();
      WindowManager.LayoutParams params = window.getAttributes();
      params.width = ViewGroup.LayoutParams.MATCH_PARENT;
      params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
      params.gravity = Gravity.BOTTOM;
  
      window.setAttributes(params);
      View decor = window.getDecorView();
      int flagset = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
      decor.setSystemUiVisibility(decor.getSystemUiVisibility() &amp; ~flagset);
  
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState)
  {
      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Theme_DialogTheme);
      //various methods adding elements to dialog
  
      Dialog dlg = builder.create();
  
      return dlg;
  
  }
  </code></pre>
  
  <p>and my styles:</p>
  
  <pre><code>&lt;style name="Theme.SnapTrash" parent="Theme.AppCompat.Light.NoActionBar"&gt;
      &lt;item name="android:statusBarColor"&gt;@android:color/black&lt;/item&gt;
      &lt;item name="colorPrimary"&gt;@color/colorSnapTrashPrimary&lt;/item&gt;
      &lt;item name="android:colorBackground"&gt;@color/colorSnapTrashPrimary&lt;/item&gt;
      &lt;item name="android:textColorPrimary"&gt;@color/colorSnapTrashTextPrimary&lt;/item&gt;
      &lt;item name="android:windowBackground"&gt;?android:attr/colorBackground&lt;/item&gt;
      &lt;item name="colorAccent"&gt;@color/colorSnapTrashAccent&lt;/item&gt;
      &lt;item name="colorPrimaryDark"&gt;@color/colorSnapTrashPrimaryDark&lt;/item&gt;
      &lt;item name="android:colorForeground"&gt;@android:color/black&lt;/item&gt;
      &lt;item name="android:textColorPrimaryInverse"&gt;@color/colorSnapTrashTextPrimaryInverse&lt;/item&gt;
      &lt;item name="android:navigationBarColor"&gt;@android:color/black&lt;/item&gt;
      &lt;item name="android:textColorSecondaryInverse"&gt;@color/secondary_text_material_dark&lt;/item&gt;
      &lt;item name="android:windowDrawsSystemBarBackgrounds"&gt;false&lt;/item&gt;
      &lt;item name="android:windowTranslucentNavigation"&gt;false&lt;/item&gt;
  
  &lt;/style&gt;
  
  &lt;style name="Theme.DialogTheme" parent="Theme.AppCompat.Light.Dialog"&gt;
      &lt;item name="android:windowBackground"&gt;@android:color/white&lt;/item&gt;
      &lt;item name="android:windowIsFloating"&gt;false&lt;/item&gt;
      &lt;item name="android:textColor"&gt;#FFEF5350&lt;/item&gt;
      &lt;item name="android:textColorPrimary"&gt;#FFEF5350&lt;/item&gt;
      &lt;item name="android:colorAccent"&gt;#999&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>