Transparent Dialog Alignment

Posted by feragusper on Stack Overflow See other posts from Stack Overflow or by feragusper
Published on 2010-02-22T21:12:09Z Indexed on 2010/05/02 4:07 UTC
Read the original article Hit count: 193

Filed under:

I'm trying to get a custom dialog with a transparent background doing this way:

this.getWindow().setBackgroundDrawableResource(R.drawable.transparent);

(where "R.drawable.transparent" is a reference to the color "#00000000")

The weird issue on this is that I can't align my dialog window. It's always aligned to the left, even if I implicit set the Gravity of the window using:

this.getWindow().setGravity(Gravity.CENTER);

And if I just comment the line which set the transparent background, the alignment works fine.

Any help would be much appreciated!

Thanks.

© Stack Overflow or respective owner

Related posts about android