Can anyone see why this is not working..
My SearchView
is in the ActionBar
and is always shown. I want to know when a user PRESSES the searchview
... not when it expands or gains focus.
This code sits within onCreateOptionsMenu
SearchView = _searchView;
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
_searchView = (SearchView) menu.findItem(R.id.menu_finder_text_search).getActionView();
_searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
_searchView.setIconifiedByDefault(false); // Do not iconify the widget, we want to keep it open!
_searchView.setFocusable(false);
_searchView.setClickable(true);
_searchView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//DO SOMETHING!
}
});
Anyone?
androidx.appcompat.R.id.search_button
– Farnesol