Android(安卓)状态栏透明的一些小结
16lz
2021-12-04
Android 状态栏颜色修改,在不同版本上有不同的特性,下面做个小结:
几个相关属性说明
1、4.4新增属性
android:fitsSystemWindows 是否为子空间预留不久android:windowTranslucentStatus 状态栏是否透明
(1)根据官方文档,如果某个View 的fitsSystemWindows 设为true,那么该View的padding属性将由系统设置,用户在布局文件中设置的
padding会被忽略。系统会为该View设置一个paddingTop,值为statusbar的高度。fitsSystemWindows默认为false。
(2)4.4开始可以设置状态栏是否透明,透明效果如下:
<?xml version="1.0" encoding="utf-8"?>
(3)上面通过设置 android:fitsSystemWindows=true 来让布局给预留状态栏的高度,所以可以看得状态栏变灰色;
(4)如果将android:fitsSystemWindows=true ,布局文件会向上移,占用状态栏空间
其他详细特性可以参考:
https://www.jianshu.com/p/5cc3bd23be7b
2、5.0新增属性
colorPrimary 应用的主要色调,actionBar默认使用该颜色,Toolbar导航栏的底色colorPrimaryDark 应用的主要暗色调,statusBarColor默认使用该颜色statusBarColor 状态栏颜色,默认使用colorPrimaryDark
5.0以上默认状态栏会采用在style.xml 设置的主题颜色
(1)如果设置了 android:windowTranslucentStatus =true ,状态栏将透明,处理情况同 上面4.4 的情况;
(2)可以通过设置statusBarColor 设置颜色
其他特性参考
https://blog.csdn.net/ddddwwww2/article/details/72868376
参考:
1、https://blog.csdn.net/ddddwwww2/article/details/72868376
2、https://www.jianshu.com/p/5cc3bd23be7b
更多相关文章
- 解决:android:editable is deprecated: Use an to make it edita
- android中ImageView的ScaleType属性
- Android控件属性大全
- android应用安全——(数据抓包)跟踪监控android数据包
- Android(安卓)设置投影效果
- Android(安卓)TabHost布局
- android如何打开系统wifi、蓝牙等设置界面
- Android(安卓)绘制2D图形
- Android之怎么隐藏EditText光标和自动显示键盘