/** * 显示或者隐藏导航栏 * * @param act * @param show */ public static void hideShowNavigationBar(Activity act, boolean show) { if (act == null || act.isFinishing()) { return; } View decorView = act.getWindow().getDecorView(); int uiOptions; if (show) { if (GlobalApplication.getInstance().NavigationIsShow()) { uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE//重新透明状态栏 | View.SYSTEM_UI_FLAG_VISIBLE;//显示导航栏, } else { uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;//重新透明状态栏 } } else { uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN;//隐藏导航栏 } decorView.setSystemUiVisibility(uiOptions); }
隐藏虚拟导航栏
最新推荐文章于 2023-06-23 18:46:32 发布