pavitran
pavitran

Reputation: 814

How to remove white background from dialog box with custom image background?

enter image description here enter image description here

i wanted to create a custom dialog like the first image for a Android game.after a lot of trial and error i was able to create a dialog box that's looks like the 2nd screenshot image.
even though it looks identical to what i wanted to achieve,but it shows white pixels around the image even though it is a png.

How can i remove the white pixels from the screenshot dialog box image and make it look identical to the first image?

Upvotes: 0

Views: 1766

Answers (1)

Shank
Shank

Reputation: 1398

Add this code to ur dialog box to make it transparent

dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

or

dialog.getWindow().setBackgroundDrawable(new ColorDrawableResource(R.color.transparent));

Upvotes: 6

Related Questions