How to remove focus from SearchView?

前端 未结 10 1467
野趣味
野趣味 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:49

    Use this line of code in your onResume method

    if (searchView != null) {
        searchView.setQuery("", false);
        searchView.clearFocus();
        searchView.onActionViewCollapsed();
    }
    

提交回复
热议问题