Difference between navigationdrawer Android Doc and navigationDrawerActivity

前端 未结 2 897
暗喜
暗喜 2021-01-29 05:36

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

相关标签:
2条回答
  • 2021-01-29 05:59

    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.

    0 讨论(0)
  • 2021-01-29 06:18

    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.

    0 讨论(0)
提交回复
热议问题