2015-03-03 71 views
0

我的應用程序的工作,我需要導航抽屜。我使用谷歌的代碼,通過這個,我得到一個導航抽屜開發抽屜式導航導航抽屜如何添加上述列表視圖

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

    <!-- Framelayout to display Fragments --> 

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

    <!-- Listview to display slider menu --> 

    <ListView 
     android:id="@+id/list_slidermenu" 
     android:layout_width="200dp" 
     android:layout_height="wrap_content" 
     android:layout_gravity="start" 
     android:background="#6495ED" 
     android:choiceMode="singleChoice" 
     android:divider="@color/list_divider" 
     android:dividerHeight="1dp" 
     android:listSelector="#fff" /> 

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

圖像視圖,但我想把一個imageview上面列表視圖。我GOOGLE了它,但我沒有得到我的意思

+0

你能告訴我們一個你想要的例子嗎? – 2015-03-03 10:06:44

+0

你可以添加headerView到ListView – virendrao 2015-03-03 10:32:37

+0

@Skizo我想設計一個導航抽屜,我想顯示用戶圖像和名稱,然後列表視圖..我知道如何顯示列表視圖,但不知道如何添加圖像視圖和文本視圖在導航抽屜中.i已經顯示了我的代碼,上面介紹了我從Google開發者網站獲取的導航抽屜。 – 2015-03-04 05:28:55

回答

0

我們可以添加一個HeaderView來列出這個userImage會像這樣的列表視圖 ViewGroup header =(ViewGroup)inflater .inflate(R.layout.headerview,mDrawerList,false);

mDrawerList.addHeaderView(header, null, false); 
相關問題