title: Android navigation bar covers bottom of screen
body: <p>For an Android app that uses Jeremy Feinstein's SlidingMenu and targets API level 29, a problem has recently been noted on 2 devices (Samsung Galaxy A01 and Samsung Galaxy Note20 Ultra, running Android 11) whereby the content at the bottom of the screen is covered by the navigation bar.</p>
  <p>The only thing that has made a difference on the 2 affected devices is adding this in the sliding menu constructors:</p>
  <pre><code>if (Build.VERSION.SDK_INT &gt;= 21) {
      setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  }
  </code></pre>
  <p>or using <code>SlidingMenu.SLIDING_CONTENT</code> instead of <code>SlidingMenu.SLIDING_WINDOW</code>.</p>
  <p>One or the other of these changes resolves the issue on the 2 devices, but on devices for which the problem has never occurred (Pixel 2, Moto X4, Nexus 6, etc., running Android 9, 10, 11) there is then a white gap at the bottom between the bottom of the screen content and the navigation bar.</p>
  <p>The 2 devices with the issue are reported to have displayed all screens correctly at an uncertain point in the past, possibly around January, around which point there was no update to the app. They belong to the same user, who reports he does not have this problem with any other apps, and for this app, only on screens that are displayed in Fragments with a custom ActionBar (removing the custom ActionBar does not help).</p>
  <p>Other things that were tried that do not help, in no particular order, include:</p>
  <ul>
  <li><p><code>android:layout_marginBottom=&quot;?attr/actionBarSize</code> Added to outermost layout of an affected screen. Creates a gap on unaffected devices and no change on affected devices.</p>
  </li>
  <li><p><code>android:adjustViewBounds=&quot;true&quot;</code> Added to all ImageViews on an affected screen, per <a href="https://stackoverflow.com/questions/30444616/some-android-phones-cutting-off-ui-at-bottom-right-of-screen">Some Android Phones Cutting Off UI At Bottom &amp; Right of Screen</a> Makes no changes.</p>
  </li>
  <li><p><code>android:fitsSystemWindows=&quot;true&quot;</code> Added to outermost layout of an affected screen. No changes.</p>
  </li>
  <li><p><code>bottomPadding += getNavBarHeight(getContext());</code> In SlidingMenu's fitSystemWindows(), creates a gap on unaffected devices and no change on affected devices,
  from <a href="https://github.com/jfeinstein10/SlidingMenu/issues/680" rel="nofollow noreferrer">https://github.com/jfeinstein10/SlidingMenu/issues/680</a></p>
  </li>
  <li><p><code>windowDrawsSystemBarBackgrounds=false</code> Creates a gap on unaffected devices and no change on affected devices, from <a href="https://github.com/jfeinstein10/SlidingMenu/issues/680" rel="nofollow noreferrer">https://github.com/jfeinstein10/SlidingMenu/issues/680</a></p>
  </li>
  <li><p><code>&lt;item name=&quot;android:windowTranslucentNavigation&quot;&gt;false&lt;/item&gt;</code> No changes, per <a href="https://stackoverflow.com/questions/27723322/bottom-soft-navigationbar-overlaps-my-listview">Bottom soft NavigationBar overlaps my ListView</a></p>
  </li>
  <li><p>wrapping the custom ActionBar XML in a LinearLayout (This <strong>did</strong> fix the problem on an emulator running Android 11, but not the physical devices. Per <a href="https://androidforums.com/threads/layouts-being-pushed-off-screen-by-appbar-and-viewpager.1089636/" rel="nofollow noreferrer">https://androidforums.com/threads/layouts-being-pushed-off-screen-by-appbar-and-viewpager.1089636/</a>)</p>
  </li>
  </ul>
  <p>So the question is, how can the problem be <strong>fixed for both the devices with the issue and for those without it</strong>? Let me know if there is any code I should post.</p>