Difference between SlidingPaneLayout and Navigatio

2019-05-03 06:05发布

问题:

I really don't know what is the difference between these two approaches of creating navigation menu. So I read that both can be used as a container for two fragments (main fragment, detail fragment). So can you help me to understand which approach is better and why? I can't find out relevant information.

thank you.

回答1:

The session was "Android Design for UI Developers" by Roman Nurik and Nick Butcher: https://developers.google.com/events/io/sessions/326204977

Pretty much what CommonsWare said, essentially, Navigation Drawer is for chrome and top level navigation, so it overlays app content. SlidingPaneLayout is for content navigation, thus it doesn't overlay content.

EDIT: The video is still available here - https://www.youtube.com/watch?v=Jl3-lzlzOJI



回答2:

So can you help me to understand which approach is better and why? I can't find out relevant information.

This was covered in a Google I|O 2013 presentation, though I forget which one.

SlidingPaneLayout is for content, such as the master-detail pattern. You might use it in place of two layouts for master-detail structures for smaller and larger screens.

DrawerLayout is for navigation. You might use it in place of the dashboard pattern, or using action bar items for navigation, if you have a fair bit of navigation in your app.