I am trying to create a custom shaped dialog in android. What I want is instead of it being rectangularly shaped, to have any shape I might want to create. Like put a custom background which is a png image in the shape of a circle.
If I do this, the area outside the circle gets filled with white to fill the rectangle of the dialog. What I need is to have only the circle and the rest of the layout to be hidden. Hope this makes sense.
From what I know this is not possible but still maybe someone has some good ideas ? Thanks.
The way to go around it is to have a custom dialog with a transparent background colour (ARGB #00000000 or Color.Transparent). After that, add a linear layout to your custom dialog with an XML drawable for a background. In that XML, specify border radius to make the layout a circle. Next, add another layout to that linear layout with both width and height set to FILL_PARENT and background set to your circular image. Finally add the rest of your dialogue components to this second layout.
I remember achieving this effect in the past, but don’t have the code handy to see the exact syntax.