Skip to content

DavidWeitbrecht/NavigationDrawer

Repository files navigation

NavigationDrawer

Navigation drawer open in all views I struggled to find a solution to having a Navigation drawer open in all activities.

I implemented the code in this stack overflow answer: https://stackoverflow.com/questions/19451715/same-navigation-drawer-in-different-activities

The stack overflow answer wasn't a complete solution so I uploaded this so beginners can see the example from beginning to end.

Overview: Create a base class which contains all the navigation drawer code etc (this code was auto generated by clicking "add new activity"->"Navigation drawer"

Created a Frame Layout in the layout "app_bar_base.xml" This frame layout will contain all new activity layouts/info etc

Created two new activities "Home" and "Gallery" Extended these classes to "Base Activity" Added a text view in each to identify the activity Instead of setContentView a layout inflator was used: FrameLayout contentFrameLayout = (FrameLayout) findViewById(R.id.content_frame); //Remember this is the FrameLayout area within your activity_main.xml getLayoutInflater().inflate(R.layout.activity_gallery, contentFrameLayout);

About

Navigation drawer open in all views

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages