标签:
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setMessage("有新消息,是否查看?"); alertDialog.setPositiveButton("否", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alertDialog.setNegativeButton("是", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); ad = alertDialog.create(); ad.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); ad.setCanceledOnTouchOutside(false);//点击外面区域不会让dialog消失 ad.show();
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
标签:
原文地址:http://www.cnblogs.com/dubo-/p/5597125.html