0

I need to design the UI as follows

enter image description here

In this Horizontal Scrolling Menu,

  1. On Select of each Main Menu Item (M1 to M9) I have to update the Sub Menu
  2. First Item will be selected by default in Sub Menu
  3. "Selected Sub Menu Item" detail will be displayed in "Display Area"

I thought of using fregments, with this I have done 2nd and 3rd point, but don't know how to achieve 1st point. So i have stopped this.

How to design this UI with the mentioned behaviour? Help me to solve this

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
user1241903
  • 129
  • 2
  • 14
  • 1
    Looks like a perfect use case for Fragments: Top Bar, Sub Menu and Display Area. For the 1st point, I suggest to pass a different key to the SubMenu Fragment. Basing on that key, it would load a different layout (or the same layout, but with different strings). – Phantômaxx Aug 09 '18 at 11:42
  • can you please tell me whats that "key" to pass submenu? are you refering to "unique id" which we can pass through an Intent? or something else? – user1241903 Aug 10 '18 at 06:44
  • Yes, an integer is enough. – Phantômaxx Aug 10 '18 at 07:14
  • 1
    i think this approach works for me. Thank you – user1241903 Aug 10 '18 at 08:55

1 Answers1

0

1. On Select of each Main Menu Item (M1 to M9) I have to update the Sub Menu

You'll need :

  1. NavigationDrawer for SubMenu.
  2. TabLayout for M1 to Mn.
  3. Fragments for displaying contents in Display Area.

You also have few options to replace/change the SubMenu:

  1. Whenever Fragment changes, get the key or id of the current Fragment, then change the SubMenu as you need.
  2. Get the current Fragment instance and update/change the SubMenu.

And the other method...

2. First Item will be selected by default in Sub Menu

Of course, you can set any item you want to be selected as default. Or:

navigationView.getMenu().getItem(0).setChecked(true);
  1. Selected Sub Menu Item" detail will be displayed in "Display Area

It sure it will. You'll just need to replace your Fragment.


Changing the SubMenu in my suggested case will not be a difficult thing to do:

https://stackoverflow.com/a/33072760/4409113

Replacing Fragment:

Replace one fragment with an another fragment

You can start with this example of NavigationDrawer, TabLayout and Fragments:

https://github.com/LinX64/AndroidSupportDesign-TabLayout

ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
  • few doubts, this app is for smart tv, is this possible to use navigationdrawer? and whenever if we select main menu item first it should update submenu and depending on focus change in submenu, display area will be changing, so i have tried the above sample app to apply focus change without success. All user interaction will be done using RCU – user1241903 Aug 10 '18 at 06:40
  • That depends on your expect of the app, that example was just for beginning. You can even customize it by a customized layout or similiar without using `NavigationDrawer`. – ʍѳђઽ૯ท Aug 10 '18 at 07:11