安卓全屏时显示底部导航栏

This commit is contained in:
fangxiang 2022-09-02 16:46:48 +08:00
parent f903543c0b
commit 5476b2c0cb
1 changed files with 16 additions and 5 deletions

View File

@ -47,15 +47,26 @@ public class MainActivity extends BridgeActivity {
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
@Override
public void onResume() {
super.onResume();
enterFullScreen();
}
@Override @Override
public void onWindowFocusChanged(boolean hasFocus) { public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus); super.onWindowFocusChanged(hasFocus);
// 隐藏底部导航栏
if (hasFocus) { if (hasFocus) {
enterFullScreen();
}
}
void enterFullScreen () {
// 隐藏底部导航栏
getWindow().getDecorView().setSystemUiVisibility( getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION View.SYSTEM_UI_FLAG_LAYOUT_STABLE /*| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION*/
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN /*| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION*/
| View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
} }
} }
}