How to make a custom dialog transparent?
10,504
Solution 1
You can also use following line in constructor
getWindow().setBackgroundDrawable(new ColorDrawable(0));
Solution 2
To make the background of the Dialog transparent you just need to set the theme of dialog to be android.R.style.Theme_Translucent_NoTitleBar. eg:-
new AlertDialog.Builder(context, android.R.style.Theme_Translucent_NoTitleBar).show();
Author by
Hardik Gajjar
Updated on June 18, 2022Comments
-
Hardik Gajjar almost 2 years
I need to make my custom dialog transparent.
How can I do that?
-
Codeversed almost 12 yearsto setBackgroundDrawable you would need a ColorDrawable and in this case @Tarun Nagpal has the correct way of doing this.