How to implement Expandable android navigation drawer with subitems?

Sagi picture Sagi · Apr 21, 2014 · Viewed 21.4k times · Source

How to implement android navigation drawer like this?

TopLevelView1 ~ TopLevelView4 can select and no children
TopVevelView5 can collaspe

My question is that if my group structure like this for example

All
Stared
Category
----mp3
----txt
----doc
----pdf

when I select all then show all file.

when I select stared then show stared file only.

when I select mp3 then show only mp3 files.

and Category can expand and collapse.

https://developer.android.com/design/media/navigation_drawer_collapse.png

Answer

canova picture canova · Apr 21, 2014

For navigation:

  • Alternative 1:

    Sliding Menu, which I would definitely go with. Even used by popular application like LinkedIn and Foursquare and easy to implement and use. Full explanation and example source codes: SlidingMenu - GitHub

  • Alternative 2:

    Android Navigation Drawer. If you want to fully customise everything yourself without using any libraries, this is your option. You can check codes and how to do it from Android Developers website: Creating a Navigation Drawer

View inside your navigation drawer / sliding menu:

  • Alternative 1:

    Android default ExpandableListView. Links: Android Developers , androidhive

  • Alternative 2:

    AnimatedExpandableListView, which is implemented from ExpandableListView, but when an item is clicked, the expand is done with a smooth animation which you may prefer to use for a better look. AnimatedExpandableListView