MenuProvider
interface MenuProvider
Interface for indicating that a component will be supplying MenuItems to the component owning the app bar.
Summary
Public functions |
|
|---|---|
Unit |
onCreateMenu(menu: Menu, menuInflater: MenuInflater)Called by the |
Unit |
onMenuClosed(menu: Menu) |
Boolean |
onMenuItemSelected(menuItem: MenuItem)Called by the |
Unit |
onPrepareMenu(menu: Menu) |
Public functions
onCreateMenu
fun onCreateMenu(menu: Menu, menuInflater: MenuInflater): Unit
Called by the MenuHost to allow the MenuProvider to inflate MenuItems into the menu.
| Parameters | |
|---|---|
menu: Menu |
the menu to inflate the new menu items into |
menuInflater: MenuInflater |
the inflater to be used to inflate the updated menu |
onMenuClosed
fun onMenuClosed(menu: Menu): Unit
Called by the MenuHost when the Menu is closed.
| Parameters | |
|---|---|
menu: Menu |
the menu that was closed |
onMenuItemSelected
fun onMenuItemSelected(menuItem: MenuItem): Boolean
Called by the MenuHost when a MenuItem is selected from the menu.
| Parameters | |
|---|---|
menuItem: MenuItem |
the menu item that was selected |
| Returns | |
|---|---|
Boolean |
|
onPrepareMenu
fun onPrepareMenu(menu: Menu): Unit
Called by the MenuHost right before the Menu is shown. This should be called when the menu has been dynamically updated.
| Parameters | |
|---|---|
menu: Menu |
the menu that is to be prepared |
| See also | |
|---|---|
onCreateMenu |