drawerlayout必须放在主界面布局后面
google的api是这样写的:
To use a DrawerLayout, position your primary content view as the first child with a width and height of match_parent. Add drawers as
child views after the main content view and set the layout_gravity appropriately. Drawers commonly use match_parent for height with
a fixed width.
布局这么写就OK了
<android.support.v4.widget.DrawerLayout
android:id="@+id/contact_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The navigation drawer -->
<include
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/activity_contact_list_center"/>
<!--侧滑布局-->
<include
android:id="@+id/contact_list_side"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
layout="@layout/activity_contact_list_side"/>
</android.support.v4.widget.DrawerLayout>