Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding the Status Bar under Android 4.2.2 (SDK 17)

Is it possible to permanently hide Navigation/Status Bar under Android 4.2.2 This solution seems not working under Jelly Bean.

I have GalaxyTab 3 (10.1) and hidding of Status Bar has no effect.
It's hidden on application Start on every screens, but i can expand it. Problem occurs also after rooting device.

Somebody has faced it before (there is also video how to fix it): forum.xda-developers.com/showthread.php?p=37466852

So my question is: Is there any way to do this on application level?

like image 503
Andrzej Reduta Avatar asked Dec 20 '22 15:12

Andrzej Reduta


2 Answers

Chris Banes and Roman Nurik have develop this usefull tool to controls the System UI easily

https://gist.github.com/chrisbanes/73de18faffca571f7292

like image 87
Aracem Avatar answered Dec 31 '22 00:12

Aracem


No, it seems like there is no way to do this for your entire application on tablets running 4.+. Also, fully disabling it so it never appears is NOT possible.

However, the solution you linked does sort of work for Android 4.2.2, (tested on Nexus S and 10 inch tablet on emulator) but even when it works it reloads the status bar if certain user interactions occur to allow navigation (for example, pressing the menu button on a phone). So this means you should plan on spamming the flag every now and then.

I personally tried with this code in my oncreate:

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();

Which resulted in:

capture

With the 4.2.2 phone the actionBar below also disappears, this does not seem to be possible for tablets.

Coming from the Android documentation about hiding the status bar, it seems that on Android 4.0 or lower, you would be able to set the fullscreen flag for the entire application and be done with it, but this has been changed to the piece of code above.

Next, the UI documentation has this to say:

The SYSTEM_UI_FLAG_LOW_PROFILE flag replaces the STATUS_BAR_HIDDEN flag. When set, this flag enables “low profile" mode for the system bar or navigation bar. Navigation buttons dim and other elements in the system bar also hide. Enabling this is useful for creating more immersive games without distraction for the system navigation buttons.

So I guess it could be that the galaxy tab 3 requires some playing around with these kinds of flags and does not support actually hiding the status bar but rather prefers making it "less visible" ...

Finally, the setSystemUiVisibility method has some great examples if you're still interested in making sure the status bar stays hidden throughout your application.

like image 39
SvenT23 Avatar answered Dec 31 '22 01:12

SvenT23