I would like to implement a button to enable/disable the immersive full screen mode. I\'m using those methods but the showSystemUI only shows quickly and hide again...
H
What worked for me is the following:
View decorView = activity.getWindow().getDecorView();
decorView.setSystemUiVisibility(0);
I might be wrong but it seems like calling setSystemUiVisibility
with 0
clears the flags which were previously applied.
Calling setSystemUiVisibility() with View.SYSTEM_UI_FLAG_VISIBLE clears all flags:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);