Russ Wheeler
Russ Wheeler

Reputation: 2630

Android navigation drawer - two levels

I am looking to replicate the iOS app my company makes and on tablet in landscape they have a second nav drawer slide out from the first for the second level of categories.

e.g. in the first level they have clothes, shoes, accessories, then if you click clothes a second one appears scrolling to the right from the far right of the first nav bar, that then shows things like shirts, t-shirt, jeans, jumpers etc.

Is this possible in android? And if so, is it the accepted way of doing things?

Thanks

Upvotes: 0

Views: 1554

Answers (2)

SathMK
SathMK

Reputation: 1171

Sure, It is possbile. But it is not a practise using in android. If you want to implement this design, the best way is to use two fragments instead of navigation drawer and use FragmentTrasation to provide the animations.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007099

on tablet in landscape they have a second nav drawer slide out from the first for the second level of categories.

That's not a nav drawer, then, at least as defined by Google.

Is this possible in android?

Sure, just not using DrawerLayout. Execute a FragmentTransaction to slide in the second list adjacent to the first list, neither of which are in a DrawerLayout.

And if so, is it the accepted way of doing things?

For a two-tier structure, I suspect that you will see other patterns used:

  • ExpandableListView
  • tabs for the first tier, and simpler master-detail for the second tier
  • action bar list navigation for the first tier, and simpler master-detail for the second tier
  • etc.

I can't even rule out DrawerLayout as being the implementation of the first tier (with traditional master-detail for the second tier), though the stuff in that list does not strike me as fitting the usage pattern for a navigation drawer.

Upvotes: 2

Related Questions