Android SearchView onclick

前端 未结 5 1819
迷失自我
迷失自我 2021-02-19 09:03

I have a searchView which looks like this:

private void setupSearchView() {
    mSearchView = (SearchView) getActivity().findViewById(
            R.id.search_vi         


        
5条回答
  •  灰色年华
    2021-02-19 09:29

    I don't see why you need to to set OnClickListener on it. By clicking on a SearchView you will update text cursor. To perform search you have a keyboard IME action. If clicking on it would perform search it would be impossible to change cursor etc. It is the generally wrong behaviour to make something else than focus / update cursor in text fields.

    As far as I remember - you don't need to hide keyboard in OnQueryTextListener. It should hite automatically. Handle your search in OnQueryTextSubmit

    search with Sherlock ActionBar SearchView setOnKeyListener

提交回复
热议问题