如何在单击导航抽屉的默认菜单上的项目时打开另一个菜单
how to open another menu on click of item on the default menu of navigation drawer
让我用图片来简单地解释一下。我有一个包含默认菜单的导航视图,类似于此。
default menu in navigation view
如果我单击一个项目,它应该会在抽屉本身中打开另一个菜单。
This is the Menu after selecting an item
这几天我一直在做一些研发,但无法得到任何想法。因为我想自己做,所以我只想要一些提示来做这件事。
提前致谢。
你应该使用片段来实现这个
在点击您的项目时用您的片段替换 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>
让我用图片来简单地解释一下。我有一个包含默认菜单的导航视图,类似于此。
default menu in navigation view
如果我单击一个项目,它应该会在抽屉本身中打开另一个菜单。
This is the Menu after selecting an item
这几天我一直在做一些研发,但无法得到任何想法。因为我想自己做,所以我只想要一些提示来做这件事。
提前致谢。
你应该使用片段来实现这个
在点击您的项目时用您的片段替换 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>