I'm trying to hide android nav bars like that :
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void hideNavBarsParent(){
mDecorView = getWindow().getDecorView();
mDecorView.setOnSystemUiVisibilityChangeListener(
new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int flags) {
hideNavBars();
}
});
}
I'm calling hideNavBars() there, realisation is -
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void hideNavBars(){
if(UrlWorker.isJelleyBean()) {
mDecorView = getWindow().getDecorView();
int uiOptions = 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_LOW_PROFILE;
mDecorView.setSystemUiVisibility(uiOptions);
But once I click anywhere they apear again, so my question is - So there is no way to hide em in android < Kitkat and without using Immersion Mode?
then i tried something as this
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void hideNavBarsParent(){
mDecorView = getWindow().getDecorView();
mDecorView.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) {
hideNavBars();
} else {
}
}
}); So they must hide in anyway when they are visible, but...
Paste this in your onCreate() method:
Using View.SYSTEM_UI_FLAG_HIDE_NAVIGATION will hide the navigation bar and put up an invisible window, blocking your app from receiving all touch events. The next touch event will "break the glass" and restore the navigation bar. There is no way to change that behavior prior to 4.4.
Using Immersive Mode in 4.4 allows you to request a slight change to this behavior via some additional flags, allowing interactive apps without a navigation bar. But the navigation bar can always be restored with a swipe from the bottom of the screen, and the system can restore the bar at any time.