How to remove focus from SearchView?

前端 未结 10 1492
野趣味
野趣味 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 23:08

    I had just request focus to some other viewgroup and it removed focus from th searchview. Like in the parent viewgroup eg(Linearlayout, RelativeLayout) in which searchview is present, add

    focusable = false; focusableInTouchMode=true
    

    to the parent viewgroup.

提交回复
热议问题