Can't click the buttons behind the DrawerLayout

前端 未结 1 438
南笙
南笙 2021-01-13 16:24

here is my xml:



        
相关标签:
1条回答
  • 2021-01-13 17:15

    According to the Navigation Drawer guide the DrawerLayout should be the root of your layout. It should have only 2 children - one that contains your "main content" - buttons, text fields, etc. And the other one should be the content of the drawer itself. Something like this:

    <android.support.v4.widget.DrawerLayout>
    
        <RelativeLayout>
            <Button/>
            <EditText/>
        </RelativeLayout>
    
        <ListView android:id="@+id/drawer_list" />
    
    </android.support.v4.widget.DrawerLayout>
    

    In addition: The order of the 2 children is important due to the Z-order of the DrawerLayout (which is a ViewGroup). The list view should be declared after your main content so that it's ordered(and displayed) in front of it.

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