How to make SearchView lose focus and collapse when clicking elsewhere on activity
问题 In my app, I'm making a search interface in which the SearchView collapses and expands when it loses and gains focus respectively. However, the losing focus thing is only happening in two cases: When the back button is pressed. When the home icon beside the SearchView is pressed. I want it to lose focus (and hence collapse) if the user clicks not only on these two things, but anywhere else on the screen (e.g., any button or any blank portion of the screen without a view on it). 回答1: Well I