'Hide statusbar when displaying a service view/window

I have a foreground service that displays a window after a button press. Is there a way I can hide (or overly) the system status bar on the display of the service window? Are there any flags that I can use? I tried searching everywhere with no luck.



Solution 1:[1]

You should use the following flags:

yourLayout.setSystemUiVisibility(
    View.SYSTEM_UI_FLAG_IMMERSIVE |
    // Set the content to appear under the system bars so that the
    // content doesn't resize when the system bars hide and show.
    View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
    View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
    // Hide the nav bar and status bar
    View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
    View.SYSTEM_UI_FLAG_FULLSCREEN
);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Graziano