不推荐使用MenuItemCompat.setOnActionExpandListener [英] MenuItemCompat.setOnActionExpandListener deprecated
本文介绍了不推荐使用MenuItemCompat.setOnActionExpandListener的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些代码可以设置布尔值(无论搜索视图是否打开).
I have some code that sets a boolean if the search view is open or not.
MenuItemCompat.setOnActionExpandListener(action_search, new MenuItemCompat.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item){
isSearch = true;
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item){
isSearch = false;
return true;
}
});
有效.我对它的响应方式感到满意.但是,它显示为已弃用,setOnActionExpandListener被警告删除
It works. I'm happy with the way it responds. However, it it shows as deprecated, the setOnActionExpandListener is crossed out with the warning
不推荐使用android.support.v4.view.MenuItemCompat.setOnActionExpandListener
android.support.v4.view.MenuItemCompat.setOnActionExpandListener is deprecated
建议?
推荐答案
android.support.v4.view.MenuItemCompat.setOnActionExpandListener
已弃用
是 MenuItemCompat.setOnActionExpandListener
.此方法已在API级别26.1.0中弃用.
Yes MenuItemCompat.setOnActionExpandListener
This method was deprecated in API level 26.1.0.
建议?
查看全文