Hey, what’s up, guys. You use lots of android apps these days. You have probably seen that three horizontal bars on the top-left side of some app. When you touch the bars or when you swipe from the left edge of of the activity a layout slides out , that’s NavigationDrawer.
NavigationDrawer is implemented by adding DrawerLayout to the activity.
So let’s see its official definition first.
Navigation drawers provide access to destinations and app functionality, such as switching accounts. They can either be permanently on-screen or controlled by a navigation menu icon.
Now let me give you a visual idea of NavigationDrawer.
Now that you have an idea of NavigationDrawer, let’s see how can you implement NavigationDrawer in your app.
I have created a simple app that demonstrate DrawerLayout and NavigationDrawer. You can find the code for the app on my github page.- Click here to see the code.
Here’s the steps to follow –
- Create basic fragments and activities for the app’s content.
- Create options for the drawer (menu_navigation.xml – see the code)
- Create a header for the drawer (navigation_header.xml).
- Add the Navigation drawer to the app’s main activity.
Here’s the screenshot of the final app.
That’s all about Android NavigationDrawer and DrawerLayout.