Android 如何在导航抽屉的默认菜单上单击项目打开另一个菜单

Android 如何在导航抽屉的默认菜单上单击项目打开另一个菜单,android,android-studio-3.0,Android,Android Studio 3.0,让我用图像简单地解释一下。我有一个navigationview,其中包含一个默认菜单,与此类似 如果我点击一个项目,它应该会在抽屉中打开另一个菜单 在过去的几天里,我一直在做一些研发工作,但没有任何想法。因为我想自己做,所以我只想得到一些提示 提前感谢您。您应该使用片段来实现这一点 单击项目时,用片段替换FrameLayout <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.androi

让我用图像简单地解释一下。我有一个navigationview,其中包含一个默认菜单,与此类似

如果我点击一个项目,它应该会在抽屉中打开另一个菜单

在过去的几天里,我一直在做一些研发工作,但没有任何想法。因为我想自己做,所以我只想得到一些提示


提前感谢您。

您应该使用片段来实现这一点

单击项目时,用片段替换FrameLayout

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

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/white"
        android:orientation="vertical">

        <FrameLayout
            android:id="@+id/frmContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </FrameLayout>

    </LinearLayout>

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

您应该为此使用我想从一个菜单导航到抽屉中的另一个菜单。按照此检查此