沉浸栏的用法

it2024-12-19  7

1.沉浸栏设置颜色的方式:try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(this.getResources().getColor(R.color.main_theme_green)); //底部导航栏 //window.setNavigationBarColor(this.getResources().getColor(R.color.main_theme_green)); }} catch (Exception e) { e.printStackTrace();}requestWindowFeature(Window.FEATURE_NO_TITLE);

 

2.沉浸栏全屏显示,顶部无背景无顶部栏: //无titlerequestWindowFeature(Window.FEATURE_NO_TITLE);//全屏getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN);setContentView(R.layout.activity_layout);

转载于:https://www.cnblogs.com/snowalwaysboy/p/7850550.html

相关资源:vue项目中使用Hbuilder打包app 设置沉浸式状态栏的方法
最新回复(0)