I was trying to explore the new navigation drawer that is standardized by Google. Finally we have the official code as well.
I was trying to understand the best way to implement the same in my app.
My Structure of the app is as follows
-MainActivity
----Featured Tab
----Favorites Tab
On Clicking of any Element in either Tab it will take me below
ContentActivity
----Info Tab
----Map Tab
Now what i am confused is all the above has to be placed into the new View for the Nav Drawer.
And As the Nav Drawer Structure is something like this
An Activity with a layout which contains navdraw-view and intern it contains content-layout and drawer layout. On clicking an option in the drawer should i replace the content layout all together or should i open a new Activity ?
The navigation drawer is a UI panel that shows your app's main navigation menu. The drawer appears when the user touches the drawer icon in the app bar or when the user swipes a finger from the left edge of the screen.
Android App Development for BeginnersStep 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.
As detailed in the documentation for Creating a Navigation Drawer under "Handle Navigation Click Events", it works using Fragments. When the user chooses an option you only replace the content Fragment, allowing the navigation drawer to stay where it is. If you follow the documentation then you should be fine.
If you've not yet encountered Fragments then it would be worth reading up on them in the documentation for Fragments. They're sort of like activities, with a few differences to allow Android to show multiple fragments at a time.
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