2个回答
展开全部
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.findItem(R.id.basic).setVisible(!getBasicVisibility());
menu.findItem(R.id.advanced).setVisible(!getAdvancedVisibility());
return true;
}
@Override
public boolean onMenuItemClick(MenuItem item) {
return onOptionsItemSelected(item);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.clear_history:
mHistory.clear();
mLogic.onClear();
break;
case R.id.basic:
if (!getBasicVisibility() && mPager != null) {
mPager.setCurrentItem(BASIC_PANEL, true);
}
break;
case R.id.advanced:
if (!getAdvancedVisibility() && mPager != null) {
mPager.setCurrentItem(ADVANCED_PANEL, true);
}
break;
}
return super.onOptionsItemSelected(item);
}
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.findItem(R.id.basic).setVisible(!getBasicVisibility());
menu.findItem(R.id.advanced).setVisible(!getAdvancedVisibility());
return true;
}
@Override
public boolean onMenuItemClick(MenuItem item) {
return onOptionsItemSelected(item);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.clear_history:
mHistory.clear();
mLogic.onClear();
break;
case R.id.basic:
if (!getBasicVisibility() && mPager != null) {
mPager.setCurrentItem(BASIC_PANEL, true);
}
break;
case R.id.advanced:
if (!getAdvancedVisibility() && mPager != null) {
mPager.setCurrentItem(ADVANCED_PANEL, true);
}
break;
}
return super.onOptionsItemSelected(item);
}
2013-11-23
展开全部
PopupMemu就行了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询