How do I make DrawerLayout to display below the Toolbar?

前端 未结 7 1060
耶瑟儿~
耶瑟儿~ 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 16:03

    I had issues getting this to work, and it finally displayed properly. Here is the layout I used:

    <LinearLayout...[add your namespaces, etc]
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:fitsSystemWindows="true">
    
        <android.support.v7.widget.Toolbar [your custom toolbar] />
        <android.support.v4.widget.DrawerLayout [your drawer layout] />
            <LinearLayout>
                [content here]
            </LinearLayout>
         <android.support.design.widget.NavigationView />
    </LinearLayout>
    

    Be careful moving the design widgets around, if one is under the wrong root tag, you'll get a

    "no layout_gravity_left"

    exception.

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