单击导航抽屉项目会触发华为设备上的 fragment

Clicking on navigation drawer item triggers the fragment behind on Huawei devices

点击导航抽屉项目会触发其后片段的onClick事件。它适用于其他设备,但我的一位用户抱怨他无法点击导航抽屉项目。他用的是华为G Play Mini。有什么办法可以解决吗?

这是我的 xml。

<!-- The important thing to note here is the added fitSystemWindows -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/my_drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <!-- Your normal content view -->
    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <LinearLayout
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#FAFAFA"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:background="#802196F3" />

        <!--<TextView
            android:id="@+id/acc"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/menu_background"
            android:gravity="center"
            android:onClick="onMenuClicked"
            android:padding="16dp"
            android:text="@string/menu_acc"
            android:textColor="#212121"
            android:textSize="16sp" />-->

        <TextView
            android:id="@+id/setup"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/menu_background"
            android:gravity="center"
            android:onClick="onMenuClicked"
            android:padding="16dp"
            android:text="@string/menu_setup"
            android:textColor="#212121"
            android:textSize="16sp" />


        <TextView
            android:id="@+id/settings"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/menu_background"
            android:gravity="center"
            android:onClick="onMenuClicked"
            android:padding="16dp"
            android:text="@string/menu_settings"
            android:textColor="#212121"
            android:textSize="16sp" />

        <TextView
            android:id="@+id/tutorial"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/menu_background"
            android:gravity="center"
            android:onClick="onMenuClicked"
            android:padding="16dp"
            android:text="@string/menu_tutorial"
            android:textColor="#212121"
            android:textSize="16sp" />

        <TextView
            android:id="@+id/converter"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/menu_background"
            android:gravity="center"
            android:onClick="onMenuClicked"
            android:padding="16dp"
            android:text="@string/menu_converter"
            android:textColor="#212121"
            android:textSize="16sp" />

        <TextView
            android:id="@+id/about"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/menu_background"
            android:gravity="center"
            android:onClick="onMenuClicked"
            android:padding="16dp"
            android:text="@string/menu_about"
            android:textColor="#212121"
            android:textSize="16sp" />

        <TextView
            android:id="@+id/buypro"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/menu_background"
            android:gravity="center"
            android:onClick="onMenuClicked"
            android:padding="16dp"
            android:text="@string/menu_buy"
            android:textColor="#212121"
            android:textSize="16sp" />


    </LinearLayout>

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

使用 NavigationView 而不是 LinearLayout。

您可以查看更详细的示例here

该页面上显示的示例是这样的(我还添加了您的 FrameLayout):

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <!-- your content layout -->
    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/drawer_header"
        app:menu="@menu/drawer"/>
</android.support.v4.widget.DrawerLayout>

注意 app:headerLayout="@layout/drawer_header" 可用于定义页眉布局(例如,您的 drawer_header.xml 包含单个 ImageView)。要填充列表,您需要一个菜单​​资源文件(例如 menu 目录中的 drawer.xmlapp:menu="@menu/drawer" 属性链接到该文件。