android 动态menu
2010-07-22 01:17:00 来源:WEB开发网switch(gameState)
{
case GAME_STATE_MENU:
menu.setGroupVisible(MENU_GROUP_MENU, true);
menu.setGroupVisible(MENU_GROUP_GAME, false);
menu.setGroupVisible(MENU_GROUP_HELP, false);
break;
case GAME_STATE_HELP:
menu.setGroupVisible(MENU_GROUP_MENU, false);
menu.setGroupVisible(MENU_GROUP_GAME, false);
menu.setGroupVisible(MENU_GROUP_HELP, true);
break;
case GAME_STATE_ABOUT:
menu.setGroupVisible(MENU_GROUP_MENU, false);
menu.setGroupVisible(MENU_GROUP_GAME, false);
menu.setGroupVisible(MENU_GROUP_HELP, true);
break;
default:
menu.setGroupVisible(MENU_GROUP_MENU, false);
menu.setGroupVisible(MENU_GROUP_GAME, true);
menu.setGroupVisible(MENU_GROUP_HELP, false);
break;
}
return true;
}
//点击菜单之后的效果
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_HELP:
//点击帮助菜单
initHelp();
return true;
case MENU_START:
initGame();
return true;
case MENU_ABOUT:
initAbout();
return true;
case MENU_OTHER:
return true;
case MENU_SET:
return true;
}
return false;
}
来自:http://www.mobilesdn.com/?action-viewnews-itemid-107
更多精彩
赞助商链接