第一次点击回退键SearchView焦点消失,再次点击退出界面,两次点击回退键问题

来源:互联网 发布:上海宏知检测 编辑:程序博客网 时间:2024/06/05 12:39
实现一次点击回退键,界面退出
searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {    @Override    public void onFocusChange(View v, boolean hasFocus) {        LogUtils.d(TAG, "hasFocus " + hasFocus);        if (!hasFocus) {            onBackPressed();        }    }});
原创粉丝点击