How to remove focus from SearchView?

前端 未结 10 1501
野趣味
野趣味 2021-02-06 22:20

I want to remove focus and text from SearchView in onResume().

I tried searchView.clearFocus() but it is not working.

Thi

10条回答
  •  庸人自扰
    2021-02-06 22:56

    Write this code in onResume()

      searchView.setText("");    
      this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);     
    

提交回复
热议问题