Search code examples
androidbackgrounddialogtransparentcardview

How to make transparent background for CardView in android?


I tried to make a transparent background, but the solutions that I tried didn't work.

The background color of the parts I marked.

When I click a marker on the map this dialog should open with transparent background. How can I do it?


Solution

  • If you are using a dialog, then please try

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

    before calling dialog.show()