我是靠谱客的博主 耍酷钥匙,这篇文章主要介绍MENU菜单的设计,现在分享给大家,希望可以做个参考。

public boolean onMenuItemSelected(int featureId, MenuItem item) { switch (item.getItemId()) { case Menu.FIRST + 1: // 这里就是设置弹出对话框的地方 new AlertDialog.Builder(YcMusicPlay.this) .setIcon(R.drawable.dialog_information).setTitle("关于") .setMessage(R.string.about).setPositiveButton("确定", null) .show(); break; case Menu.FIRST + 2: new AlertDialog.Builder(YcMusicPlay.this) .setIcon(R.drawable.dialog_information) .setTitle("提示") .setMessage("你确定要退出Yc音乐吗?") .setPositiveButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { /* 在这里设计当对话框按钮单击之后要运行的事件 */ stopService(new Intent(YcMusicPlay.this, YcMusicService.class)); System.exit(0); } }).setNegativeButton("取消", null).show(); break; } return false; }

最后

以上就是耍酷钥匙最近收集整理的关于MENU菜单的设计的全部内容,更多相关MENU菜单内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(109)

评论列表共有 0 条评论

立即
投稿
返回
顶部