我正在尝试隐藏状态和导航栏,但显示操作栏。
class MyActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_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;
decorView.setSystemUiVisibility(uiOptions);
...
}
...
}
此代码效果很好。但如果按[VOLUME UP],[VOLUME DOWN]或[POWER],会出现状态栏和导航栏。
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
我省略了decorView.setSystemUiVisibility(uiOptions);
和上面的代码。按[VOLUME UP],[VOLUME DOWN]或[POWER]时,状态栏消失,不会出现。但导航栏不会消失。
按[VOLUME UP],[VOLUME DOWN]或[POWER]时,
如何摆脱状态栏和导航栏?
我怎么能离开行动吧?