Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a custom navigation drawer in android

Hi I'm trying to create a navigation drawer similar to gmail app navigation drawer. I follow the developer site but it only specify about basic implementation. But I need to customize the navigation according to my specifications.

  1. I need to add a header to categorize the list item in Drawer
  2. I need a radio button to select some of my options

How can I do this?

like image 909
chathura Avatar asked Feb 15 '14 10:02

chathura


People also ask

How do I make a custom navigation drawer?

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

The tutorial Android Custom Navigation Drawer (via archive.org) contains a basic and a custom project. The latter shows how to setup a Navigation Drawer as shown in the screenshot:

NavigationDrawerCustom

The source code of the projects (via archive.org) is available for download.


The is also the Navigation Drawer - Live-O project ...

Navigation Drawer - Live-O

The source code of the project is available on GitHub.


The MaterialDrawer library aims to provide the easiest possible implementation of a navigation drawer for your application. It provides a great amount of out of the box customizations and also includes an easy to use header which can be used as AccountSwitcher.

MaterialDrawer library demo


Please note that Android Studio meanwhile has a template project to create a Navigation Drawer Activity as shown in the screenshot.

Navigation Drawer Activity

This repository keeps track of changes being made to the template.

like image 82
JJD Avatar answered Oct 17 '22 18:10

JJD