I trying to search solution many long time ,Now i found it as below code, it works.
AlertDialog.Builder builder=new AlertDialog.Builder(getApplicationContext());
//builder.setView(R.layout.popup_activity);
builder.setTitle("Test alertdialog");
builder.setMessage("your message for show alert!!");
builder.setIcon(R.drawable.tanksmall_2);
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// FIRE ZE MISSILES!
}
});
builder.setNegativeButton("View", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
AlertDialog dialog=builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
dialog.show();
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
lp.dimAmount=1.0f;
dialog.getWindow().setAttributes(lp);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
I hope help someone who need like me, thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.