当前位置:网站首页>设置状态栏颜色
设置状态栏颜色
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);
边栏推荐
- Construction and maintenance of business websites [12]
- Construction and maintenance of business websites [10]
- JVM面试篇
- A quick understanding of digital electricity
- [learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)
- query词权重, 搜索词权重计算
- Duplicate keys detected: ‘0‘. This may cause an update error. found in
- golang---锁
- What style of Bluetooth headset is easy to use? High quality Bluetooth headset ranking
- What is the MySQL column to row function
猜你喜欢
[pit] how to understand "parameter fishing"
JVM interview
golang---锁
Vsocde has cli every time it is opened js
Opengauss database backup and recovery guide
leetcode2311. 小于等于 K 的最长二进制子序列(中等,周赛)
JVM面试篇
[graduation season] graduate seniors share how to make undergraduate more meaningful
leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
Word search applet design report based on cloud development +ppt+ project source code + demonstration video
随机推荐
Es interview questions
how to come in an investnent bank team
软件开发生命周期 --瀑布模型
RTL8189FS如何关闭Debug信息
JS slow animation
MySQL约束与多表查询实例分析
DNS domain name resolution
Webgpu (I): basic concepts
[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)
Ar Augmented Reality applicable scenarios
No programming code technology! Four step easy flower store applet
MySQL operates the database through the CMD command line, and the image cannot be found during the real machine debugging of fluent
[graduation season] graduate seniors share how to make undergraduate more meaningful
【liuyubobobo-玩转Leetcode算法面试】【00】课程概述
【带你学c带你飞】2day 第8章 指针(练习8.1 密码开锁)
If you want to rewind the video picture, what simple methods can you use?
From January 11, 2007 to January 11, 2022, I have been in SAP Chengdu Research Institute for 15 years
trading
Sword finger offer II 031 Least recently used cache
【OpenCV】-5种图像滤波的综合示例