0

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. enter image description here

AKSHAY MANAGOOLI
  • 120
  • 2
  • 2
  • 21

2 Answers2

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
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