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.
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.
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.
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.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With