Java Code Examples for android.support.v7.widget.SearchView#setImeOptions()
The following examples show how to use
android.support.v7.widget.SearchView#setImeOptions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BookCategoryFragment.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.fragment_category, menu); MenuItem item = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) item.getActionView(); searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { mBookCategoryRecyclerViewAdapter.getFilter().filter(newText); return true; } }); }
Example 2
Source File: QuestionsActivity.java From mvp-android-arch-component with MIT License | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.questions, menu); // Setup search widget in action bar SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setQueryHint(getString(R.string.search_hint)); searchView.setImeOptions(EditorInfo.IME_ACTION_DONE); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { presenter.search(newText); return true; } }); return true; }