Dialog(弹窗)
Dialog一般用自定义的,系统自带的也有
//系统自带Dialog
AlertDialog.Builder b=new AlertDialog.Builder(Reign.this); b.setTitle("是否登录");//设置标题 b.setMessage("是否登录"); //设置内容 b.setPositiveButton("是", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent i = new Intent(); Bundle bundle=new Bundle(); i.setClass(Reign.this, Login.class); bundle.putSerializable("data", (Serializable) user); i.putExtras(bundle); startActivity(i); dialog.dismiss(); } }); b.setNegativeButton("否", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(Reign.this, "还是登录吧", Toast.LENGTH_SHORT).show(); dialog.dismiss();//销毁弹窗 } }); b.create().show();//先create,再show
//b.setCancelable(true);点击空白处,是否消失弹窗,默认是true,消失
//学了自定义在说
posted on 2016-05-06 15:53 huaihuaibuguai 阅读(291) 评论(0) 编辑 收藏 举报
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步