在这里,我想在单击“<”按钮时隐藏 Search+ 按钮,如下所示单击它时如何采取行动是否有任何@override 方法?
这是我的代码:
private MenuItem item2;
item2 = menu1.getItem(0); // get position of item
item2.setOnActionExpandListener(new OnActionExpandListener() { // perform on click action here
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
// TODO Auto-generated method stub
item2 = menu1.getItem(2).setVisible(false); // hide button
item2 = menu1.getItem(1).setVisible(true); // enable button
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
// TODO Auto-generated method stub
item2 = menu1.getItem(1).setVisible(false); // hide button
item2 = menu1.getItem(2).setVisible(true); // enable button
return true;
}
});