我们在引用android.support.v4包中的drawerlayout时经常出现这种错误
DrawerLayout must be measured with MeasureSpec.EXACTLY.
<android.support.v4.widget.DrawerLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@+id/toolbar"
android:fitsSystemWindows="true">
<include layout="@layout/drawercontent"></include>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"></LinearLayout>
</android.support.v4.widget.DrawerLayout>
其实原因很简单,drawerlayout必须给一个确定的大小不能用wrap_content换成其他的问题就解决了。