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

前端 未结 5 1061
时光说笑
时光说笑 2020-12-30 03:22

I\'ve been playing with Google\'s new design support library and it\'s a blast! I\'m just a little stumped though on the navigation view. All the things I read say that the

相关标签:
5条回答
  • 2020-12-30 03:50

    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.

    0 讨论(0)
  • 2020-12-30 03:52

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

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

    I hope it helps you..

    0 讨论(0)
  • 2020-12-30 03:53

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

    0 讨论(0)
  • 2020-12-30 03:56

    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

    0 讨论(0)
  • 2020-12-30 04:00

    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.

    0 讨论(0)
提交回复
热议问题