答案 0 :(得分:0)
我尝试很长时间搜索解决方案,现在我发现它如下面的代码,它可以工作。
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);
我希望帮助那些需要我的人,谢谢