Is it possible to put a search option on the right of the action bar without having to create a custom action bar ?
Asked
Active
Viewed 128 times
1 Answers
0
Follow this code If you are action bar sherlock, you can implement search menu in action bar
public boolean onCreateOptionsMenu(Menu menu) {
menu.add("Search")
.setIcon(R.drawable.search)
.setActionView(R.layout.search_layout)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_COLLAPSE_VIEW);
return true;
}
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
//What do i write here?
return true;
}
In search_layout.xml
place a edittext that's enough.