Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pairing bottom app bar with top app bar?

In the picture what I want to do.

Pic

I have two menu.xml files. How to add the first menu at top app bar and the second at the bottom app bar? Can I do this in one activity or I should create activity with top app bar + fragment with a bottom app bar? Thanks.

like image 788
Vlad Avatar asked Aug 24 '18 08:08

Vlad


1 Answers

So, I solved this problem.

For toolbar on top of the activity I use setSupportActionBar() inflate menu in onCreateOptionsMenu() and processing MenuItem click in onOptionsItemSelected()

For BottomAppBar (new material component) I use bottomAppBar.replaceMenu() in order to set the menu. For processing MenuItem click: bottomAppBar.setOnMenuItemClickListener()

Result

like image 165
Vlad Avatar answered Oct 19 '22 05:10

Vlad