2

I am trying to implement Android sidebar. I know how to implement sliding sidebar with Drawer layout. The first pic is list and when I click on one of the item it shows the relevant list items. How to do this? please help me.

First pic with side headings

List based on first pic heading

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
Voora Tarun
  • 1,266
  • 1
  • 20
  • 38

2 Answers2

1

You can clear Whole Menu on Item Selection of NavigationView

    mainNavigationMenu_.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(MenuItem menuItem) {
            //IT WILL HAPPEN ON BASIS OF ITEM ID OF MENU....
            navView.getMenu().clear();
            navView.inflateMenu(R.menu.second_menu);
            return true;
        }
    });

OR

you can change group of menu Simple and effective way.

Thanks :)

Community
  • 1
  • 1
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
0

I have followed the @Code-Apprentice comment.

Created a fragment for mainlist and another fragment for sublist. Once the mainlist item is selected, the mainlist fragment will be replaced by sublist with relevant data and added some fragment transaction animations. it worked well.

Voora Tarun
  • 1,266
  • 1
  • 20
  • 38