View view = getWindow().getDecorView();
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
//得到当前界面的装饰视图
if(Build.VERSION.SDK_INT >= 21) {
View decorView = getWindow().getDecorView();
//设置让应用主题内容占据状态栏和导航栏
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
//设置状态栏和导航栏颜色为透明
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().setNavigationBarColor(Color.TRANSPARENT);
}
//隐藏标题栏
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
Android去除顶部标题栏
猜你喜欢
转载自blog.csdn.net/qq_35562291/article/details/90267209
今日推荐
周排行