Immersive mode - only hide status bar + rehide status bar after some time without user interaction

android hide status bar programmatically
hide status bar android
android immersive mode
android 9 immersive mode
android immersive mode programmatically
android screenshot without status bar
hide status bar apk
auto hide status bar android

I have an activity with 2 toolbars, one at the top and one at bottom. I use inversive mode and this works fine now, it allows the user to drag down the status bar...

The problem, the status bar is never hidden again, after it was dragged down...

I found a few solutions here, but I just could not get it working. Either the status bar is shown over my view, or it messes up if I open the overflow menu or it just does not get hidden again...

This is what I currently use:

@Override
protected void onResume()
{
    super.onResume();
    enableFullScreenMode();
}

private void enableFullScreenMode()
{
    if (Build.VERSION.SDK_INT < 16)
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    else
        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_FULLSCREEN
//                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
//                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
        );
}

What I want

  • always fullscreen until the user drags down the status bar
  • after for example 3s the status bar should be hidden again, if it was not opened
  • after closing the status bar it should be hidden again
  • when opening my overflow menu in the toolbar, the status bar should NOT show up

//1.put this after on click.

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        hideSystemUI();
    }
}

private void hideSystemUI() {
    // Enables regular immersive mode.
    // For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
    // Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY
    View decorView = getWindow().getDecorView();
    decorView.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);
}

//2.Remove "android:fitsSystemWindows="true"" from everywhere from you layout.

//3.Add hideSystemUI() in onResumes like this ,(for, auto re hiding status and bottom navigation ).

@Override
public void onResume() {
    super.onResume();
    hideSystemUI();
}

Immersive Mode? (hide notification bar), buttons, i'd like to also entirely hide the top status/notification bar so that the home screen is just one unbroken full screen image. possible? Full -> Will hide both the status bar and the navigation bar Status -> Will only hide the status bar Navigation -> Will only hide the navigation bar None -> Will leave both system bars visible No root required! No draining background services! No hacky or buggy overlays! Just a simple and clean user interface which applies your settings in real

The answer is, Sticker immersive mode.

As the doc says:

"The bars automatically disappear after a few seconds of no interaction or as soon as the user touches or gestures anywhere outside the system bars."

private void hideSystemUI() {
    View decorView = getWindow().getDecorView();
    decorView.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                    | 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);
}

Hide Status Bar ( Immersive Mode) Help : galaxys10, Is there a way to hide the status bar through without it creating a black bar on top ? I tried through ADB commands but it just created a black bar on top. When i hide the notification bar by enabling immersive mode on my galaxy s8 plus If i want to write a text message,when i open the keyboard, the top half of the screen gets cut off so i don't see the messages,only the keyboard and a blank screen are visible on the screen.

try this:

View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener
        (new View.OnSystemUiVisibilityChangeListener() {
    @Override
    public void onSystemUiVisibilityChange(int visibility) {
        // Note that system bars will only be "visible" if none of the
        // LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
        if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
            // TODO: The system bars are visible. Make any desired
            // adjustments to your UI, such as showing the action bar or
            // other navigational controls.
        } else {
            // TODO: The system bars are NOT visible. Make any desired
            // adjustments to your UI, such as hiding the action bar or
            // other navigational controls.
        }
    }
});

How to Enable Immersive Mode on Android, Tap it again to display only the status bar. Tap it again to hide both the status and navigation bars. Tap it once more to return to the default settings� Immersive mode - only hide status bar + rehide status bar after some time without user interaction. Ask Question Asked 4 years, 8 months ago. Active 12 months ago.

Hide the status bar, more of the display space, thereby providing a more immersive user experience. Figure 2 shows an app with a hidden status bar. You can hide the status bar on Android 4.0 (API level 14) and lower by setting The method setSystemUiVisibility() only has an effect if the view you call it from is visible. Hide Navigation Bar and Status Bar(Permanent Immersive Mode) on Samsung Galaxy S9 and S9 Plus:- Samsung has recently launched its two best of flagship devices known as Samsung Galaxy S9 and S9 Plus. Both devices are one of the most expensive , premium looking , powerful devices of 2018 .

Enable fullscreen mode, You might be tempted to enable fullscreen mode just to maximize screen The immersive mode is intended for apps in which the user will be heavily how to hide and show the status and navigation bars in your activity,� When the immersive mode is enabled, you can just swipe from the bottom or the top to see the status bar or the navigation bar. Disabling Specific Apps From Using Immersive Mode There are certain apps which do not play nice with “Immersive Mode”.

Android Question - Immersive Mode, Immersive Mode there is also a mode where only the navigation bar (at the bottom) is hidden.? so the status bar is always visible? regards� There are three different versions of Immersive Mode—one that hides the status bar, one that hides the navigation bar, and one that hides both. As a result, there are three different commands you can use, so pick the one that suits your needs best. To auto-hide only the status bar at the top of your screen, send this command:

Comments
  • german comments...
  • Removed the single comment... Nit-picky and non productive comment though...
  • to be fair - im working on the same problem and will post you the solution when i found it ;)
  • Would be nice. Currently I've implemented a solution that's working, but the statusbar is not hiding automatically anymore (I don't know when it's shown so I can't trigger calling the hide function). So it stays visible until the user clicks on the screen again... Which is fine