This question has been asked before: AlertDialog custom title has black border
But was not answered satisfactorily - and is missing some information.
I
If you look at the AlertDialog class source you'll see most of the methods are simply proxy methods (facade) around private AlertController mAlert
.
Looking at the AlertController class source you'll see 4 interesting member variables:
private int mViewSpacingLeft;
private int mViewSpacingTop;
private int mViewSpacingRight;
private int mViewSpacingBottom;
private boolean mViewSpacingSpecified = false;
Setting mViewSpacingSpecified
to true
will remove the borders on the top and bottom of the dialog.
This is done properly by changing this line:
dialog.setView(layout);
to:
dialog.setView(layout, 0, 0, 0, 0);