Last active
August 29, 2015 14:26
-
-
Save mgumiero9/b6e8b09690aab165ceed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This snippet hides the system bars. | |
private void hideSystemUI() { | |
// Set the IMMERSIVE flag. | |
// Set the content to appear under the system bars so that the content | |
// doesn't resize when the system bars hide and show. | |
View mDecorView = getWindow().getDecorView(); | |
mDecorView.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 // hide nav bar | |
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar | |
| View.SYSTEM_UI_FLAG_IMMERSIVE); | |
} | |
// This snippet shows the system bars. It does this by removing all the flags | |
// except for the ones that make the content appear under the system bars. | |
private void showSystemUI() { | |
View mDecorView = getWindow().getDecorView(); | |
mDecorView.setSystemUiVisibility( | |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment