android 沉浸式主题记录
16lz
2021-12-04
方式一:代码设置
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){//判断系统版本5.0以上 Window window = this.getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);// window.setStatusBarColor(0xff01c7d4); //顶部状态栏设置根布局的背景色 也可以设置某个view的背景色 window.setStatusBarColor(activity_offline_help.getDrawingCacheBackgroundColor()); //底部导航栏设置根布局的背景色 也可以设置某个view的背景色 window.setNavigationBarColor(activity_offline_help.getDrawingCacheBackgroundColor()); }
方式二:style适配
1.创建一个values-v21文件夹
2.写入theme
3.在manifest中应用
android:name=".activity.StorageSetActivity" android:screenOrientation="portrait" android:theme="@style/AppBaseTheme" />
更多相关文章
- Android中设置activity的background为Wallpaper
- android layout布局属性
- flutter 与 android 混合开发 以及 Android与flutter之间的通信
- android相对布局
- android环境变量设置以及adb的常用命令
- 安卓---EditText控件的使用
- Android标题栏、状态栏、全屏
- Android(安卓)Trick 8: ProgressBar的圆形和长条形设置
- android 设置 TextView