当drawerlayout划出来之后,再往回滑时发现滑不回去了,是因为没有将NavigationView放到最后面,将NavigationView放到最后面就可以滑回去了,代码如下:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
...(其他代码)
<android.support.design.widget.NavigationView
android:id="@+id/navi"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:visibility="gone"
app:headerLayout="@layout/toubuju"
app:menu="@menu/cehuamenu"/>
</android.support.v4.widget.DrawerLayout>