Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New Navigation Drawer - how to use titles and counters?

http://developer.android.com/design/patterns/navigation-drawer.html

I've read through the tutorial to create the navigation drawer, but what do I have to do to also use the title, icons, and counters as part of the drawer items? I only see in the example how to control the text.

like image 997
Jason Hocker Avatar asked May 28 '13 13:05

Jason Hocker


People also ask

How to use navigation drawer?

The drawer icon is displayed on all top-level destinations that use a DrawerLayout . To add a navigation drawer, first declare a DrawerLayout as the root view. Inside the DrawerLayout , add a layout for the main UI content and another view that contains the contents of the navigation drawer.

How to use drawer layout in android?

To use a DrawerLayout, position your primary content view as the first child with width and height of match_parent and no layout_gravity> . Add drawers as child views after the main content view and set the layout_gravity appropriately. Drawers commonly use match_parent for height with a fixed width.

How to make custom navigation drawer in android?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. Step 3 − Add the following code to res/layout/nav_header_main.


1 Answers

You have to manage the navigation drawer UI with a specific layout. Once you wrapped your activity layout with the navigation drawer layout and added your listview, you have to create a new layout.xml (wrap and add all the stuff you want and specify in your first listview this layout.

Layout examples : https://gist.github.com/jordanblt/6220779

A more specific answer about title : How to add title in Navigation drawer layout?

like image 119
Jordan Avatar answered Oct 06 '22 13:10

Jordan