Android隐藏状态栏、导航栏

时间:2023-11-28 12:15:26

Android隐藏状态栏、导航栏

  1. private void hideStatusNavigationBar(){
  2. if(Build.VERSION.SDK_INT<16){
  3. this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  4. WindowManager.LayoutParams.FLAG_FULLSCREEN);
  5. }else{
  6. int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  7. | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
  8. | View.SYSTEM_UI_FLAG_FULLSCREEN //hide statusBar
  9. | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; //hide navigationBar
  10. getWindow().getDecorView().setSystemUiVisibility(uiFlags);
  11. }
  12. }