Max Vé Max Vé - 4 years ago 76
Android Question

Implement Navigation Drawer on Activity

I've created a Navigation Drawer in Android Studio with : File > New > Activity > Navigation Drawer Activity.
It work very good, but how I can add this Navigation Drawer in my mainactivity or in other activity? Because it's a problem, It's two different activity...
Sorry for my English i'm French :(

Answer Source

Navigation Drawer activity template has only one activity, If you want to use this template then that activity should be your main activity.

I mean simply move your old main activity's code the Navigation Drawer's activity which created with the template and make it your new App's main activity!

Otherwise, you will have to implement The navigation drawer in your old main activity just like the template does



The Navigation Drawer activity template has 4 different xml layouts which usually named:

1- activity_main.xml contains the DrawerLayout and includes no. 2

2- app_bar_main.xml contains the action bar xml code and includes no. 3

3- content_main.xml this should be your main layout

4- nav_header_main contains the top view of the drawer

Note: names might be different depending on the Drawer's activity name.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download