How do I make DrawerLayout to display below the Toolbar?

前端 未结 7 1090
耶瑟儿~
耶瑟儿~ 2020-11-27 15:01

How to make the drawer layout be below the actionbar/toolbar? I\'m using v7:21 app compat library with the new ToolBar view.

Examples that I see looks like



        
7条回答
  •  爱一瞬间的悲伤
    2020-11-27 15:48

    Here is the Kotlin solution:

    In the layout file containing your DrawerLayout...

    • Add android:keepScreenOn="true" to the DrawerLayout
    • Add android:layout_marginTop="?android:attr/actionBarSize" to the NavigationView

    The full XML piece should look like this:

    
    
        
    
        
    
    
    

    That should do it (ignore my clipped nav drawer).

提交回复
热议问题