我有以下代碼:機器人動作條福爾摩斯collospe和擴大
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.layout.menu, menu);
}
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.settings:
Intent i=new Intent(class1.this, clas2.class);
startActivity(i);
return true;
}
return false;
}
我的問題是以下幾點:
我在動作條的搜索圖標。當我點擊搜索圖標時,打開編輯文本並顯示取消按鈕。搜索工作正常。現在,當我點擊取消按鈕時,我想隱藏edittext和取消按鈕。我怎樣才能做到這一點?
退房類似的帖子http://stackoverflow.com/questions/10692755/how-do-i-hide-a-menu-item-in-the-actionbar – GrIsHu