美文网首页
安卓教程之Dialog

安卓教程之Dialog

作者: 遗步看风景 | 来源:发表于2017-12-24 10:45 被阅读29次

    ProgressDialog

    ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
    progressDialog.setTitle("通知窗口");
    progressDialog.setMessage("读取中");
    progressDialog.setCancelable(true);
    #dialog弹出后会点击屏幕或物理返回键,dialog消失
    #dialog.setCanceledOnTouchOutside(false);
    #dialog弹出后会点击屏幕,dialog不消失;点击物理返回键dialog消失
    progressDialog.show();
    

    AlertDialog

    AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
    dialog.setTitle("警告窗口");
    dialog.setMessage("重要事件");
    dialog.setPositiveButton("OK",new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialog,int which){}
    });
    dialog.setNegativeButton("Cancel",new DialogInterface.OnClickListener(){
        @Override
        public void onClick(DialogInterface dialog, int which){
        }
    });
    dialog.show();
    

    相关文章

      网友评论

          本文标题:安卓教程之Dialog

          本文链接:https://www.haomeiwen.com/subject/yatcgxtx.html