[英]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.