niorgai / StatusBarCompat

Status Bar Utils ---- Change Status Bar Mode Simply
http://niorgai.github.io/2016/03/20/Android-transulcent-status-bar/
MIT License
2.16k stars 349 forks source link

华为手机无效 #4

Closed cxbiao closed 8 years ago

cxbiao commented 8 years ago

华为手机设置状态栏颜色无效。求解决方案

niorgai commented 8 years ago

@cxbiao 请问你手机型号和系统版本是?

cxbiao commented 8 years ago

华为荣耀6 EMUI3.1 Android5.1

niorgai commented 8 years ago

有在 setContentView 后调用吗? 可以看看布局吗?

cxbiao commented 8 years ago

是的,其他手机,像魅族都有效,怀疑华为手机(华为是自己家的EMUI)做了特殊处理

niorgai commented 8 years ago

...我也没有测试机..按理说 5.0 以上是不会有问题的

cxbiao commented 8 years ago

华为机型普遍存在这个问题

niorgai commented 8 years ago

其他App都不行吗?没有测试机好捉急..

cxbiao commented 8 years ago

QQ、UC。bilibi可以,

niorgai commented 8 years ago

我试试找找测试机..

niorgai commented 8 years ago

试了一下还是没有发现问题啊。。你是在setContentView之后调用的吗?

cxbiao commented 8 years ago

是在setContentView之后调用 模似机和魅族都可以, 实测发现,华为手机要在theme中显式添加下面这个

  <item name="android:windowTranslucentStatus">true</item>

然后布局中加fitsSystemWindows=true才可以

niorgai commented 8 years ago

...但是我在 荣耀6 和 mate7 上面都试了下,是正常的啊..

cxbiao commented 8 years ago

好吧,难道我的手机坏了!

niorgai commented 8 years ago

要不.... 你装了 [妈妈联盟] 试试看?

cxbiao commented 8 years ago

基本不可以,只有活动页这种全屏模式才有效!

niorgai commented 8 years ago

....太神奇了...还没有用户反馈过这个问题...我让朋友的荣耀6试的时候他的截图也是正常的

cxbiao commented 8 years ago

EMUI3.1 Android5.1是这个,有的华为手机还没有升到3.1

niorgai commented 8 years ago

嗯 那我再观察一段

cxbiao commented 8 years ago

用下面这个库可以 https://github.com/jgilfelt/SystemBarTint

niorgai commented 8 years ago

还是觉得挺奇怪的..并没有看出那个库的特别之处...没有测试机器真捉急..

cxbiao commented 8 years ago

这个库是用decorView添加,不是用contentview

niorgai commented 8 years ago

这也行吗...能不能帮我试试呢?我改好之后发一个 commit 上来

cxbiao commented 8 years ago

用decorView添加状态栏颜色都是有点半透明的,貌似QQ,UC都是这样的

niorgai commented 8 years ago

4.4 上面的效果确实是这样的 , 如果在 ContentView 添加就没有

cxbiao commented 8 years ago

不是的,是5.0才有这种半透明

niorgai commented 8 years ago

噢..我以为你是说从下到上的那种过渡..

niorgai commented 8 years ago

@cxbiao 可以再帮我试试 1.1.0 这个版本可以吗? 我把位置换到 DecorView 里面了. 这个库的最大特点是可以在不重启 Activity 的情况下切换不同模式.不知道你有没有这个需求