微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MIUI 状态栏主题问题

如何解决MIUI 状态栏主题问题

我正在尝试在 Miui 中实现透明状态栏。

我尝试了从样式到窗口标志的所有方法,但没有任何效果

ScreenShot

主题

 <!-- Status bar. -->
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:fitsSystemWindows">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>

和窗口标志

 window.setFlags(
        WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
    )
    val decorView = window.decorView
    decorView.fitsSystemWindows = true
    window.decorView.systemUIVisibility = View.SYstem_UI_FLAG_LAYOUT_STABLE or View.SYstem_UI_FLAG_LAYOUT_FULLSCREEN or View.SYstem_UI_FLAG_LIGHT_STATUS_BAR
    window.statusBarColor = Color.TRANSPARENT

我还能做些什么来隐藏状态栏?

解决方法

or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR 中删除此 window.decorView.systemUiVisibility = ...

,

这些资源帮助我解决了问题

https://medium.com/androiddevelopers/gesture-navigation-going-edge-to-edge-812f62e4e83e

还有一个代码实验室

https://codelabs.developers.google.com/codelabs/gesture-navigation#3

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。