Skip to content

Instantly share code, notes, and snippets.

@murano500k
Created July 14, 2017 14:49
Show Gist options
  • Save murano500k/4c4daea69f93bdb0855d9eb6c451e9b4 to your computer and use it in GitHub Desktop.
Save murano500k/4c4daea69f93bdb0855d9eb6c451e9b4 to your computer and use it in GitHub Desktop.
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.
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment