Skip to content

ayushpahwa/android-navigation-menu-expandable

Repository files navigation

Navigation menu with expandable list items

Sample android app for navigation menu with expandable list items in material design.

Screenshot

Features

  • Implemented using material design
  • Easy to use
  • Uses an expandable list view

Working

Layout

Add a toolbar in your layout.

<android.support.v7.widget.Toolbar	xmlns:android="http://schemas.android.com/apk/res/android"	xmlns:local="http://schemas.android.com/apk/res-auto"	android:id="@+id/toolbar"	android:layout_width="match_parent"	android:layout_height="wrap_content"	android:minHeight="?attr/actionBarSize"	android:background="?attr/colorPrimary"	local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"	local:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 

Use a normal ExpandableListView in your drawer layout.

<ExpandableListView	android:id="@+id/left_drawer"	android:layout_width="240dp"	android:layout_height="match_parent"	android:layout_gravity="start"	android:dividerHeight="1dp" android:divider="@color/list_divider"	android:listSelector="@drawable/list_selector"	android:background="@color/list_background" /> 

Adapter for expandable list view

Make a new class with BaseExpandableListAdapter

public class NavAdapter extends BaseExpandableListAdapter{ 

Attach the drawerList to ActionBarDrawerToggle object

actionBarDrawerToggle = new ActionBarDrawerToggle(this,drawer,toolbar,R.string.drawer_open,R.string.drawer_close ) 

Acknowledgments

About

Sample android app for navigation menu with expandable list items in material design.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages