Android SearchView.OnQueryTextListener OnQueryTextSubmit not fired on empty query string

后端 未结 13 904
盖世英雄少女心
盖世英雄少女心 2020-12-05 10:17

I am using Android 4.1.2. I have a SearchView widget on an ActionBar. Documentation on SearchView.OnQueryTextListener

13条回答
  •  醉话见心
    2020-12-05 10:46

    As others have mentioned this behavior is intentional. I gave up on a solution for OnQueryChangeListener and decided to workaround by implementing OnEditorActionListener on the SearchView's EditText, which you can get a handle to using R.id.search_src_text. As long as you setImeOptions of the SearchView to EditorInfo.IME_ACTION_SEARCH you can handle a click on the keyboard search button. See this SO answer for more details.

提交回复
热议问题