2017-09-14 45 views
-1

讓我通過圖像進行簡單說明。我有一個包含默認菜單的導航視圖,與此類似。如何在導航抽屜的默認菜單上點擊項目上的另一個菜單

default menu in navigation view

如果我點擊一個項目,它應該打開抽屜本身另一個菜單。

This is the Menu after selecting an item

我已經做了一些[R & d,因爲過去幾天,但無法得到任何想法。因爲我想自己做,我只想要一些提示來做到這一點。

預先感謝您。

+1

你應該使用[**可擴展的ListView **](HTTPS更換的FrameLayout:// www.google.co.in/search?client=ubuntu&hs=53U&channel=fs&dcr=0&q=Expandable+listview+github&oq=Expandable+listview+github&gs_l=psy-ab.3..0i10k1j0i22i10i30k1.4760.6623.0.7086.7.7.0.0.0.0 .201.1085.0j5j1.6.0 .... 0 ... 1.1.64.psy-ab..1.6.1080 ... 0.J55HyhqjIU8)for –

+0

我想從菜單導航到抽屜本身的另一個菜單。 –

+0

按照這個https://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/ – Ankita

回答

0

您應該使用片段來實現這個

與片段在您的項目的點擊

<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> 
相關問題