DrawerLayout 不是滑动抽屉

DrawerLayout is not a sliding drawer

我已经查看了这个问题的所有其他答案,但仍然无法解决这个错误:

app:id/drawerLayout) is not a sliding drawer

我在 closeDrawer 行遇到错误:

    mDrawerLinear = (LinearLayout) findViewById(R.id.drawerLayout);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.drawer_list);

    mDrawerLayout.closeDrawer(mDrawerLinear);

我正在设置这个内容 xml>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

   <android.support.v4.widget.DrawerLayout 
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->
    <include layout="@layout/mainv2"/>

    <!-- The navigation drawer -->
    <include layout="@layout/navigation_drawer"/>

    </android.support.v4.widget.DrawerLayout>

</RelativeLayout>

和navigation_drawer xml看起来像这样

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/drawerLayout"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:background="@android:color/black"
        android:gravity="left"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

        <TextView
        android:id="@+id/fbName"
        android:layout_width="240dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="10dp"
        android:text="Please login."
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@android:color/white"
        android:textSize="12dp" />


        </LinearLayout>

        <ListView
        android:id="@+id/drawer_list"
        android:layout_width="240dp"
        android:layout_height="match_parent"

        android:background="#111"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp" />

  </LinearLayout>

我一定是遗漏了一些明显的东西。有什么想法吗?

抽屉 LinearLayout 的重力属性有误。 android:gravity="left" 属性应该是 android:layout_gravity="left".