3

I have an Android app which uses the immersive sticky mode and it works well on previous versions of Android as well as on Android P, but when turning on the option of simulating a display cutout (notch), the content starts right below the status bar, leaving a blank space.

My code is standard immersive code:

getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

Any ideas?

Thank you.

fergaral
  • 2,077
  • 6
  • 17
  • 34
  • 1
    I am running into the same issue. I have an app that the user can toggle the status bar on and off. I have the status bar set to be translucent when it is shown and all of my content will appear on either side of the display cutout. When it is hidden though the status bar area turns black and all of my content is now shown just below the notched area. – Jeff B Mar 20 '18 at 00:33
  • My feeling is that unless absolutely necessary (like games), just leave the status bar on (or you will have to handle different notch sizes by different manufacturer). – Lim Thye Chean Aug 15 '18 at 01:43

2 Answers2

3

Nevermind, on a real device it's a totally normal behavior, because you don't want fullscreen content to be obscured by the notch (although the iPhone X does it).

Leaving this question for future reference.

fergaral
  • 2,077
  • 6
  • 17
  • 34
0

We can have full immersive experience if required for devices with display cutout by setting the window layout attribute. This is documented here.

<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">            shortEdges</item>

THis solved my problem.

Arka Prava Basu
  • 2,366
  • 3
  • 18
  • 34