LoginSignup
6
7

More than 5 years have passed since last update.

StatusBarとNavigationBarを消してFullScreenにする方法(出す方法付き)

Posted at

decorView.setSystemUiVisibility()メソッドにフラグをセットする方法です。※APIレベル14以上

private void hideStatusAndNavigationBar() {
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION || View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);
    isFullScreen = true;
}

private void showStatusAndNavigationBar() {
    View decorView = getWindow().getDecorView();
    int mask = ~(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION || View.SYSTEM_UI_FLAG_FULLSCREEN);
    int uiOptions = decorView.getSystemUiVisibility() && mask;
    decorView.setSystemUiVisibility(uiOptions);
    isFullScreen = false;
}
6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7