-
Notifications
You must be signed in to change notification settings - Fork 332
Action Menu
Mansur edited this page Jan 27, 2017
·
1 revision
To use the Action Menu in MaterialSearchBar, perform the following steps.
Create main.xml
file in res
folder
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="Item 1"/>
<item android:title="Item 2"/>
<item android:title="Item 3"/>
</menu>
searchBar = (MaterialSearchBar) findViewById(R.id.searchBar);
searchBar.inflateMenu(R.menu.main);
searchBar.getMenu().setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId())
{
case R.id.action_settings:
break;
...
}
return false;
}
});