答案 0 :(得分:0)
我使用此代码
AlertDialog.Builder builder = new AlertDialog.Builder(this,R.style.Theme_AppCompat_Light_Dialog_Alert);
builder.setTitle("Message");
builder.setIcon(R.mipmap.ic_appicon);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setMessage(status);//TODO put real question
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onDismiss(DialogInterface dialog) {
}
});
builder.show();
答案 1 :(得分:0)
使用Alertdialog.builder
时 - 它没有给出getwindow()选项。所以我们可以让它像这样工作:
AlertDialog dialog = builderScan.create();
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.show();
你的AlertDialog
背景将是transperent。
根据此answer