How to get the new NavigationView to play nice with status bar scrim?

自古美人都是妖i 提交于 2019-11-30 06:50:52

After struggling with this for several more hours, and copiously comparing my code to the cheesesquare app, I found the following: The DrawerLayout must have the attribute android:fitsSystemWindows="true", and the NavigationView as well, but the CoordinatorLayout should not. Once I made those changes, it worked.

Thanks all, and hopefully this is helpful to somebody!

You can look at my code for the layout here.

-Justin

Sỹ Phạm

set this to your navigationView android:fitsSystemWindows="false"

You should check newer SDK examples.

actually they are using Coordinatorlayout in activity that you want to draw under statusbar and have different theme for that layout, because if you put transparent statusbar for other activities where you don't have root layout Coordinatorlayout it will show white uncolored statusbar.

set this to your navigationView android:fitsSystemWindows="true" this will ensure that the navigation will be behind the statusbar and add colorAccent to your style in values folder.

In your style file try to use AppCompact theme as parent ...

 <style name="AppTheme" parent="Base.Theme.AppCompat">

I hope it helps you..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!