Comments (2)
学废了学废了,小米里面必须加上这两行:
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
在小米开放平台有提供这两行代码
然后再设置颜色
```
window?.decorView?.systemUiVisibility = systemUiFlag(call.arguments as Boolean, true)
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
private fun systemUiFlag(statusBarLight: Boolean, navigationBarLight: Boolean): Int {
var flag = (View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> {
if (statusBarLight) flag = flag or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
if (navigationBarLight) flag = flag or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
if (statusBarLight) flag = flag or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
return flag
}
from ultimatebarx.
对了,因为在flutter里面要把FlutterActivity改成FlutterFragmentActivity,才能用插件,比较麻烦,就直接把相关代码提取出来了(项目也没看懂是怎么实现的........)
from ultimatebarx.
Related Issues (20)
- 0.7.1版本引用失败?
- #
- kotlin.UninitializedPropertyAccessException
- 更新依赖androidx.appcompat:appcompat至1.3.0及以上会出现Fragment显示为空白
- 偶现崩溃 lateinit property context has not been initialized HOT 7
- 状态栏灰色背景怎么去掉? HOT 1
- 只能在onCreateVIew 生命周期之后使用?
- k40 pro miui 12.5.8 新增隐藏手势线标识,如下方法不能完全判断是否开启了手势提示线 HOT 1
- 有没有办法实现Android5.0的状态栏的深色文字图标呢?
- 在github直接搜索状态栏,找不到我们这个库啊,这是什么操作,老哥
- 多进程初始化崩溃 HOT 2
- 布局浸入效果不对
- 沉浸式状态栏,偶现底部多了一块空白区域 HOT 4
- bug: ViewPager2+Fragment不能及时更新状态栏字体颜色
- 无法隐藏导航栏
- 横屏导航栏位置问题
- java完全支持吗
- 是不维护了吗
- anr报错
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ultimatebarx.