Can't close NavigationDrawer with right-to-left swipe

后端 未结 3 937
情深已故
情深已故 2021-02-04 02:07

I have been trying to fix the problem I\'ve got, which is that I\'m unable to close the NavigationDrawer by swiping from right-to-left, without success. Opening it by swiping fr

相关标签:
3条回答
  • 2021-02-04 02:18

    I think the XML causes your problem. The ListView (left_drawer) should be the last element in your XML so it can overlay your content and catch your swipe gesture.

    If you put your ViewPager within the FrameLayout (that's why it's called content_frame), it should work as expected.

    0 讨论(0)
  • 2021-02-04 02:28

    just put the navigation view as the last element of your drawer layout

    0 讨论(0)
  • 2021-02-04 02:35

    Yeah peitek is right to be more clarify this is my xml file.

    <fragment
        android:id="@+id/single_map_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"/>
    
    <include
        layout="@layout/app_bar_map_view_tt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/single_map_appbar"/>
    
    <!--This should be the last element to maintain right to left closing gesture.-->
    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_map_view_tt"
        app:menu="@menu/activity_map_view_tt_drawer" />
    

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