1. 出现问题的布局
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> <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/drawer_layout" android:layout_height="match_parent" android:layout_width="match_parent" android:fitsSystemWindows="true"> <include layout="@layout/include_list_viewpager"/> <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="256dp" android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" app:menu="@menu/drawer_view" /> <include layout="@layout/include_inner_guide"/> </android.support.v4.widget.DrawerLayout>
2. 原因
在查看DrawerLayout的源码和调试过程中发现include_inner_guide布局被当做DrawerLayout的ContentView,故事件被DrawerLayout拦截了
3. 解决办法
a. 将include_inner_layout移到include_list_viewpager中
b. 及时移除include_inner_layout生成的view