below is the image of my dialog box executed on android 19,
i want to remove that red marked background area. How to remove that in android 19, please help,
Thanks in advance.
Asked
Active
Viewed 80 times
0

AKSHAY MANAGOOLI
- 120
- 2
- 2
- 21
-
Possible duplicate : https://stackoverflow.com/questions/16186818/set-transparent-background-to-alertdialog-in-android – Haresh Chhelana May 23 '17 at 13:31
2 Answers
1
i got it using this code
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();

AKSHAY MANAGOOLI
- 120
- 2
- 2
- 21
-
previously i was using only "AlertDialog" then i changed to "AlertDialog.Builder" and changed code as above – AKSHAY MANAGOOLI May 23 '17 at 13:51
0
When using Alertdialog.builder
- Its not giving getwindow() option in it. So we can make it work like this:
AlertDialog dialog = builderScan.create();
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.show();
And your Background of AlertDialog
will be transperent.
According to this answer

Stanojkovic
- 1,612
- 1
- 17
- 24