What I want to achieve is like this image (Without top NavigationView
though) but with Toolbar
Menu + BottomAppBar
Menu + BottomNavigationDrawerFragment
exactly like material design:
I could manage the BottomAppBar
menu by replace()
(My Answer):
val bottomBar = findViewById<BottomAppBar>(R.id.bottomAppBar)
bottomBar.replaceMenu(R.menu.menu_main)
Which allow me to inflate menu for the BottomAppBar
and used below codes plus onCreateOptionsMenu()
for the Toolbar
Menu and setSupportActionBar()
:
val toolbar = findViewById<Toolbar>(R.id.myToolbar)
setSupportActionBar(toolbar)
The point is, in this tutorial (for example), he used setSupportActionBar(bottom_app_bar)
for setting SupportActionBar
on the BottomAppBar
. So, if we use setSupportActionBar(bottom_app_bar)
for the BottomAppBar
, it will show the BottomNavigationDrawerFragment
+ Menus are handlable on the Bottom Side.
But, what about Toolbar
and menus? Toolbar
+ menu items won't be handlable nor showing up if we use setSupportActionBar(bottomAppbar)
.
The things that I have tested are:
- Might sound ridiculous but used two
setSupportActionBar()
for bothToolbar
andBottomAppBar
- Even tried to inflate two menus by
onCreateOptionsMenu()
method but none worked.
The question is, How can we have Top Toolbar
Menu + BottomAppBar
Menu + BottomNavigationDrawerFragment
all together?
Any thoughts?