Home Coding Android Coding Adding a Navigation Drawer in Android Studio

Adding a Navigation Drawer in Android Studio



With the latest component updates in Android, it is very easy to add a navigation drawer to your app. By default, users can slide it into view from the side. The latest version of Android Studio already includes a project template for an app that makes use of a navigation drawer, but for learning purposes, we’ll start to build a navigation drawer from scratch. To simplify things, we are also going to include a toggle switch in the action bar, so the users have multiple ways of interacting with our navigation drawer.

How to Create a Navigation Drawer in Android Studio

1. Create a New Android Studio project.

2. Leave the default minimum SDK.

3. Select an Empty Activity.

4. Insert the following dependencies into build.gradle:

5.  Insert this code in activity_main.xml:

6. Now lets set up MainActivity.java:

7. This is what our AndroidManifest.xml and strings.xml files looked like:

8. This is what the end result would look like:

Denis Madroane App junkie, Android developer, proud Freelancer. Passionate about app development and blogging, updated with the new stuff. Likes to think that he's versed in app re-skinning, content writing and social media.


Your email address will not be published. Required fields are marked *

Powered by WordPress