Linked Questions

Popular Questions

An app I am working on uses transparent system bars on Android versions which support it. This is accomplished by the following definition in the style:

<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>

<item name="android:windowDrawsSystemBarBackgrounds">true</item>

And the following code:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
    /* Make system bars fully transparent */
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}

In normal mode this works as expected: both the status and the navigation bar are overlaid over the app content.

In split-screen mode this works for the status bar but not for the navigation bar: in portrait mode, when the app is at the bottom, the navigation bar is black but getWindow().getDecorView().getRootWindowInsets().getSystemWindowInsetBottom() reports an inset of 144 pixels. The height of the decor view is 144 pixels less than that of the root view (without split screen they are both equal, as the app does not have an action bar). Similar symptoms in landscape mode when the app is on the right (as the navigation bar).

Adding the View.SYSTEM_UI_FLAG_LAYOUT_STABLE flag does not have any effect.

The device is a smartphone, i.e. a device that defaults to portrait and shows the navigation bar on the side when in landscape mode.

Is that a bug in the Android distribution I am using (LineageOS 15.1, Android 8.1.0), or am I missing something? Should the navigation bar be transparent in split screen mode? If not, how can I reliably determine which parts of my view are going to be obscured by the system bars?

Related Questions