繁体   English   中英

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

[英]how to open another menu on click of item on the default menu of navigation drawer

让我简化通过图像解释的过程。 我有一个导航视图,其中包含一个默认菜单,与此类似。

导航视图中的默认菜单

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

选择项目后的菜单

过去几天以来,我一直在进行一些研发工作,但无法获得任何想法。 因为我想自己做,所以我只想一些提示。

先感谢您。

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

单击项目后,用片段替换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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM