4

I use AlertDialog.Builder to make a custom dialog using these instructions: http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog

It works, but my view is inside a black box (the standard dialog frame). This box has padding around its edges, so i cant make it use the full display width.

How can I get rid of the padding? I fetched the layoutparams after the dialog is displayed, and changed all the parameters and flags, nothing helped.

When someone else asked this here on SO, the answer was

builder.setView(dialogView, 0, 0, 0, 0);

but as far as I see, this method doesnt exist, only setView(dialogView).

3 Answers3

2

It's not builder.setView You need to create an instance of the dialog first:

Dialog dialog = builder.create();
dialog.setView(dialogView, 0, 0, 0, 0);
npace
  • 4,218
  • 1
  • 25
  • 35
1

I believe the only way to do this is to use the base (or extended) Dialog class and setView to set a custom view.

You'll also have to add your own buttons and handle them accordingly.

Austin Hanson
  • 21,820
  • 6
  • 35
  • 41
0

If just want to get rid of the black borders, you can invert the color by:

setInverseBackgroundForced(true);

But thats not a correct solution, it is just to get rid of the black borders wich some people have asked for.

Regards

Halle
  • 11
  • 2