Android 抽屉打开时,可单击导航抽屉背面视图

Android 抽屉打开时,可单击导航抽屉背面视图,android,Android,我已经创建了一个带有listview和自定义布局的导航抽屉。 每当我在抽屉部分的列表视图外单击某个内容时,我的导航抽屉就会出现一种strage行为。我怎样才能禁用它 我的布局代码如下 <RelativeLayout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="mat

我已经创建了一个带有listview和自定义布局的导航抽屉。 每当我在抽屉部分的列表视图外单击某个内容时,我的导航抽屉就会出现一种strage行为。我怎样才能禁用它

我的布局代码如下

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

    <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <android.support.v4.view.ViewPager
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </android.support.v4.view.ViewPager>

        <RelativeLayout
            android:id="@+id/left_drawer"
            android:layout_width="270dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:background="#20262d" >

            <RelativeLayout
                android:id="@+id/layoutuserimg"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#292f37"
                android:clickable="true"
                android:paddingBottom="15dp"
                android:paddingTop="15dp" >

                <ImageView
                    android:id="@+id/image_view"
                    android:layout_width="60dp"
                    android:layout_height="60dp"
                    android:layout_marginLeft="15dp"
                    android:layout_marginTop="15dp"
                    android:background="@drawable/userverified" />

                <TextView
                    android:id="@+id/username"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="20dp"
                    android:layout_toRightOf="@+id/image_view"
                    android:text="John Bardeen"
                    android:textColor="#ffffff"
                    android:textSize="24sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/username"
                    android:layout_marginLeft="10dp"
                    android:layout_toRightOf="@+id/image_view"
                    android:text="Verified"
                    android:textColor="#009900"
                    android:textSize="12sp" />

                <TextView
                    android:id="@+id/lblwallet"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/image_view"
                    android:layout_marginLeft="15dp"
                    android:text="Wallet :"
                    android:textColor="#ff8214"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/txtwallet"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/image_view"
                    android:layout_marginLeft="2dp"
                    android:layout_toRightOf="@+id/lblwallet"
                    android:text="Wallet"
                    android:textColor="#ffffff"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/lblescrow"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/lblwallet"
                    android:layout_marginLeft="15dp"
                    android:text="Escrow :"
                    android:textColor="#ff8214"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/txtescrow"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/txtwallet"
                    android:layout_marginLeft="2dp"
                    android:layout_toRightOf="@+id/lblescrow"
                    android:text="Escrow"
                    android:textColor="#ffffff"
                    android:textSize="14sp" />
            </RelativeLayout>

            <ListView
                android:id="@+id/list_sliderlist"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/layoutuserimg"
                android:layout_gravity="start"
                android:layout_marginTop="10dp"
                android:background="#20262d"
                android:choiceMode="singleChoice"
                android:divider="#15181c"
                android:dividerHeight="1dp"
                android:scrollbars="none" />

            <Button
                android:id="@+id/btnlogout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:background="#333942"
                android:paddingBottom="20dp"
                android:paddingTop="20dp"
                android:text="Logout"
                android:textColor="#0d0f12" />
        </RelativeLayout>

        <!-- <RelativeLayout -->
        <!-- android:layout_width="match_parent" -->
        <!-- android:layout_height="match_parent" -->
        <!-- android:background="#ffffff" -->
        <!-- > -->
    </android.support.v4.widget.DrawerLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="50dp" >

        <!-- <ImageView -->
        <!-- android:layout_width="fill_parent" -->
        <!-- android:layout_height="wrap_content" -->
        <!-- android:layout_alignParentTop="true" -->
        <!-- android:src="@drawable/topfiveline" /> -->

        <com.viewpagerindicator.CirclePageIndicator
            android:id="@+id/indicator"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true" />
    </RelativeLayout>

</RelativeLayout>


我还尝试了mDrawerRelativeLayout.getParent().RequestDisallowWinterCeptTouchEvent(true);在onDrawerOpened(View drawerView){}方法中,但这不适用于mehi,这里有一个导航抽屉的示例: