how to handle back button of Search View in android

前端 未结 4 1249
刺人心
刺人心 2021-02-19 13:24
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(Menus.SEARCH));
searchView.setQueryHint(this.getString(R.string.search));
editSearch = (E         


        
4条回答
  •  猫巷女王i
    2021-02-19 13:29

    MenuItemCompat.setOnActionExpandListener is now deprecated

    use

    menu.findItem(R.id.action_search)setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
        @Override
        public boolean onMenuItemActionExpand(MenuItem menuItem) {
            return false;
        }
    
        @Override
        public boolean onMenuItemActionCollapse(MenuItem menuItem) {
            return false;
        }
    });
    

    instead

提交回复
热议问题