zhanghai / PatternLock

Material Design Pattern Lock with auth flow implementation
687 stars 153 forks source link

设置状态栏颜色导致提示性文字(mMessageText)消失 #9

Closed hkq325800 closed 8 years ago

hkq325800 commented 8 years ago

系统版本MIUI6.7.1.0 android4.4.4KTU84P ConfirmPatternActivity、SetPatternActivity中由于以下代码造成mMessageText无法显示 activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 对mMessageText设置textcolor也无法解决

zhanghai commented 8 years ago

项目里使用的就是普通的 TextView,问题可能不是透明状态栏导致的,而是其他因素。我没有小米设备所以也无法重现。

你这几天有什么进展么?

hkq325800 commented 8 years ago

在pl_base_pattern_activity.xml里面应该在最外面的LinearLayout中加入android:fitsSystemWindows="true"否则不然在android5.0版本以上不仅textView不显示下面的"取消"和"忘记图案"也会被某些机型的虚拟按键挡住

zhanghai commented 8 years ago

嗯……

我个人觉得,或许大家不应该使用 FLAG_TRANSLUCENT_STATUS?它不符合设计规范,也会强制全屏布局;虽然可以在这里加上 fitsSystemWindows,但是这样的话 StatusBar 和 NavigationBar 的背景也就只会是 windowBackground 加上那个 Scrim 了。在我的理解里,大多数应用的行为只需要是只为 5.0+ 使用 status/navigationBarColor 等开启着色就好了,5.0 以下则不实现。

基于这些原因我这段时间里一直不太愿意合并这个 PR(另一个原因是期末太忙没心情打这些以及很多其他的字QAQ)。当然如果你能说服我有这个必要,我也会很感谢地合并的。

hkq325800 commented 8 years ago

Thanks for communicating,I have realized that I shouldn't use chinese on github I doubt I can't convince you to use FLAG_TRANSLUCENT_STATUS,but I believe that anything existing is reasonable. Besides,fitsSystemWindows has no harm to this project. Besides besides,transparent navigation bar can be achieved on Android4.4 too,I have tried almost all ways to tint navigationBar, FLAG_TRANSLUCENT_STATUS is necessary to fit most Roms to complete this in China.

zhanghai commented 8 years ago

Alright. But in general, something just being reasonable is not sufficient for its being correct.

In this case, if you use FLAG_TRANSLUCENT_STATUS, I would also recommend your doing more customization on the layout (for example for the color under the translucent status bar). A convenient approach provided by the build process is to simply drop in a (slightly modified) file named pl_base_pattern_activity.xml in your project's res/layout{,-land}/, and that will override the layout file from the library when merging resources.

So I'm not going to merge this PR but leave the work to be done by users with their own considerations for customization. Do you think it's ok?

hkq325800 commented 8 years ago

yes,thank you!