如果你的NavigationDrawer里面的Item沒有響應,Drawer不能左滑關閉,應該是因為你沒有把主要內容放在DrawerLayout標簽下的第一位。
The main content view (the FrameLayout above) must be the first child in the DrawerLayout because the XML order implies z-ordering and the drawer must be on top of the content.
比如把CoordinatorLayout放在NavigationDrawer的第一位。
更多:
The main content view (the FrameLayout above) must be the first child in the DrawerLayout because the XML order implies z-ordering and the drawer must be on top of the content.
The main content view is set to match the parent view's width and height, because it represents the entire UI when the navigation drawer is hidden.
The drawer view (the ListView) must specify its horizontal gravity with the android:layout_gravity attribute. To support right-to-left (RTL) languages, specify the value with "start" instead of "left" (so the drawer appears on the right when the layout is RTL).
The drawer view specifies its width in dp units and the height matches the parent view. The drawer width should be no more than 320dp so the user can always see a portion of the main content.
1、顯示界面主要內容的View (上面的 FrameLayout ) 必須為DrawerLayout的第一個子View, 原因在于 XML 布局文件中的View順序為Android系統中的 z-ordering順序,而Navigation Drawer必須出現在內容之上。
2、顯示界面內容的View寬度和高度設置為和父View一樣,原因在于當Navigation Drawer不可見的時候,界面內容代表整個界面UI。
3、Navigation Drawer (上面的 ListView) 必須使用android:layout_gravity屬性設置水平的 gravity值 .如果要支持 right-to-left (RTL,從右向左閱讀)語言 用 "start" 代替 "left" (當在 RTL語言運行時候,菜單出現在右側)。
4、抽屜菜單的寬度為 dp 單位而高度和父View一樣。抽屜菜單的寬度應該不超過320dp,這樣用戶可以在菜單打開的時候看到部分內容界面。
http://developer.android.com/training/implementing-navigation/nav-drawer.html