📅  最后修改于: 2022-03-11 14:52:28.936000             🧑  作者: Mango
private void hideSystemBars() {
WindowInsetsControllerCompat windowInsetsController =
ViewCompat.getWindowInsetsController(window.getDecorView());
if (windowInsetsController == null) {
return;
}
// Configure the behavior of the hidden system bars
windowInsetsController.setSystemBarsBehavior(
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
);
// Hide both the status bar and the navigation bar
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
}