zoukankan      html  css  js  c++  java
  • menu

    @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            menu.add(0,0,0,"关于");
            menu.add(0,1,1,"退出");
            return super.onCreateOptionsMenu(menu);
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            switch(item.getItemId()){
                case 1:
                    AlertDialog.Builder builder=new AlertDialog.Builder(this).setTitle("退出").setMessage("确定要退出吗?").setPositiveButton("取消", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                          alertDialog.dismiss();
                        }
                    }).setNegativeButton("确定",new DialogInterface.OnClickListener(){
    
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            finish();
                        }
                    }).setCancelable(false);
                    alertDialog=builder.create();
                    alertDialog.show();
                    break;
            }
            return super.onOptionsItemSelected(item);
        }
  • 相关阅读:
    Java ListIterator(迭代器)
    java 异常 throw
    java iterator(迭代器)
    java list
    type Iterator does not take parameters
    Java 容器的打印
    java 添加一组元素
    Java 容器的基本概念
    软件
    java 学习网站
  • 原文地址:https://www.cnblogs.com/zqxLonely/p/5549200.html
Copyright © 2011-2022 走看看