欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android 11隐藏状态栏和导航栏

程序员文章站 2024-03-01 09:58:04
...
// Hide both the navigation bar and the status bar.
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

// Hide Action bar.
ActionBar actionBar = getSupportActionBar();
// Notice:Replace getSupportActionBar() with getActionBar() if you aren't using androidx...
if (actionBar != null) {
	actionBar.hide();
}