I want to implement a navigation drawer, and try to understand how it works. I have tested the navigationDrawerActivity that we can choose in Android Studio with an activity_mai
So I don't understand why it's different between android studio and the doc.
The template used in Android Studio is more recent than the doc which is not updated.
With the new Design Support Library you can use the NavigationView
inside your DrawerLayout
to achieve in a very simple way a NavigationDrawer which follows the material guidelines.
Can you tell me why is there this difference?
The only difference is the use of the NavigationView
instead of a ListView.
Of course you can use what you want inside the DrawerLayout
.
The doc just provides a way to demonstrate how simply DrawerLayout
works, so you will learn how to use basic stuff like creating the drawer, handle navigation clicks and open/close the drawer.
The activity_main
comes from Android Studio is not only that, it also brings some material design to your app. Stuff like the NavigationView
, AppBarLayout
they all come from Android Design Support Library. But the usage of DrawerLayout
is more or less the same.