完美解决DrawerLayout抽屉实现不能点击后面的控件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/codekxx/article/details/53510606

这里写图片描述

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <!-- 主界面布局 -->
    <LinearLayout >

        ...
    </LinearLayout>
    <!-- 右侧菜单布局 -->
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/drawer_layout"
        android:layout_width="275dp"
        android:layout_height="match_parent"
        android:layout_gravity="right"
        android:background="@color/white"
        android:clickable="true" <!--重点-->
    >
    </RelativeLayout>

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

出现问题是:点击右侧的抽屉菜单,事件确实被主界面上的控件响应.

解决办法:

 android:clickable="true"

猜你喜欢

转载自blog.csdn.net/codekxx/article/details/53510606