当前位置:网站首页>设置状态栏颜色
设置状态栏颜色
2022-07-02 02:20:00 【Rannki】
导入依赖: implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
// 设置状态栏颜色为白色
ImmersionBar.with(this).statusBarColor(R.color.white)
.fitsSystemWindows(true).init();基本用法(满足日常沉浸式):ImmersionBar.with(this).init();
ImmersionBar.with(this)
.transparentStatusBar() //透明状态栏,不写默认透明色
.transparentNavigationBar() //透明导航栏,不写默认黑色(设置此方法,fullScreen()方法自动为true)
.transparentBar() //透明状态栏和导航栏,不写默认状态栏为透明色,导航栏为黑色(设置此方法,fullScreen()方法自动为true)
.statusBarColor(R.color.colorPrimary) //状态栏颜色,不写默认透明色
.navigationBarColor(R.color.colorPrimary) //导航栏颜色,不写默认黑色
.barColor(R.color.colorPrimary) //同时自定义状态栏和导航栏颜色,不写默认状态栏为透明色,导航栏为黑色
.statusBarAlpha(0.3f) //状态栏透明度,不写默认0.0f
.navigationBarAlpha(0.4f) //导航栏透明度,不写默认0.0F
.barAlpha(0.3f) //状态栏和导航栏透明度,不写默认0.0f
.statusBarDarkFont(true) //状态栏字体是深色,不写默认为亮色
.flymeOSStatusBarFontColor(R.color.btn3) //修改flyme OS状态栏字体颜色
.fullScreen(true) //有导航栏的情况下,activity全屏显示,也就是activity最下面被导航栏覆盖,不写默认非全屏
.hideBar(BarHide.FLAG_HIDE_BAR) //隐藏状态栏或导航栏或两者,不写默认不隐藏
.addViewSupportTransformColor(toolbar) //设置支持view变色,可以添加多个view,不指定颜色,默认和状态栏同色,还有两个重载方法
.titleBar(view) //解决状态栏和布局重叠问题,任选其一
.titleBarMarginTop(view) //解决状态栏和布局重叠问题,任选其一
.statusBarView(view) //解决状态栏和布局重叠问题,任选其一
.fitsSystemWindows(true) //解决状态栏和布局重叠问题,任选其一,默认为false,当为true时一定要指定statusBarColor(),不然状态栏为透明色
.supportActionBar(true) //支持ActionBar使用
.statusBarColorTransform(R.color.orange) //状态栏变色后的颜色
.navigationBarColorTransform(R.color.orange) //导航栏变色后的颜色
.barColorTransform(R.color.orange) //状态栏和导航栏变色后的颜色
.removeSupportView(toolbar) //移除指定view支持
.removeSupportAllView() //移除全部view支持
.navigationBarEnable(true) //是否可以修改导航栏颜色,默认为true
.navigationBarWithKitkatEnable(true) //是否可以修改安卓4.4和emui3.1手机导航栏颜色,默认为true
.fixMarginAtBottom(true) //已过时,当xml里使用android:fitsSystemWindows="true"属性时,解决4.4和emui3.1手机底部有时会出现多余空白的问题,默认为false,非必须
.addTag("tag") //给以上设置的参数打标记
.getTag("tag") //根据tag获得沉浸式参数
.reset() //重置所以沉浸式参数
.keyboardEnable(true) //解决软键盘与底部输入框冲突问题,默认为false,还有一个重载方法,可以指定软键盘mode
.init(); //必须调用方可沉浸式
如果想隐藏状态栏,则可以这样设置:
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
边栏推荐
- Redis环境搭建和使用的方法
- No programming code technology! Four step easy flower store applet
- CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
- 附加:信息脱敏;
- Oracle creates a user with read-only permission in four simple steps
- How to hide the scroll bar of scroll view in uniapp
- Calculation (computer) code of suffix expression
- [learn C and fly] day 5 chapter 2 program in C language (Exercise 2)
- [learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)
- CSDN insertion directory in 1 second
猜你喜欢

Design and implementation of key value storage engine based on LSM tree

RTL8189FS如何关闭Debug信息

【带你学c带你飞】2day 第8章 指针(练习8.1 密码开锁)

What are the necessary things for students to start school? Ranking list of Bluetooth headsets with good sound quality
![[technology development -21]: rapid overview of the application and development of network and communication technology -1- Internet Network Technology](/img/2d/299fa5c76416f74bd1a693c433dd09.png)
[technology development -21]: rapid overview of the application and development of network and communication technology -1- Internet Network Technology

How to solve MySQL master-slave delay problem

附加:信息脱敏;

leetcode2309. The best English letters with both upper and lower case (simple, weekly)

Redis有序集合如何使用

As a software testing engineer, will you choose the bank post? Laolao bank test post
随机推荐
A quick understanding of analog electricity
How to execute an SQL in MySQL
Deployment practice and problem solving of dash application development environment based on jupyter Lab
Calculation (computer) code of suffix expression
[pit] how to understand "parameter fishing"
Pytest testing framework
[learn C and fly] 4day Chapter 2 program in C language (exercise 2.5 generate power table and factorial table
How does MySQL solve the problem of not releasing space after deleting a large amount of data
【带你学c带你飞】3day第2章 用C语言编写程序(练习 2.3 计算分段函数)
How to use redis ordered collection
LFM信号加噪、时频分析、滤波
【带你学c带你飞】day 5 第2章 用C语言编写程序(习题2)
What is the MySQL column to row function
What are the necessary things for students to start school? Ranking list of Bluetooth headsets with good sound quality
MySQL operates the database through the CMD command line, and the image cannot be found during the real machine debugging of fluent
Sword finger offer 29 Print matrix clockwise
【毕业季】研究生学长分享怎样让本科更有意义
MySQL主从延迟问题怎么解决
MySQL约束与多表查询实例分析
2022安全员-C证考试题及模拟考试