Java – How to remove white bars from custom dialogs in Android?

How to remove white bars from custom dialogs in Android?… here is a solution to the problem.

How to remove white bars from custom dialogs in Android?

I want to remove the white border of my custom dialog. I found a lot on Stack Overflow. But still didn’t get a solution. How to remove this white border. Please someone help me with this. Thanks in advance.

Solution

Try using Dialog instead of AlertDialog.Builder and remove the border line from Dialog:

Dialog dialog = new Dialog(this,android. R.style.Theme_Translucent_NoTitleBar);

And you must replace the window contents of the dialog box View. I think you can use it in the dialog constructor :

this.getWindow().setContentView(R.layout.your_dialog_view);

Related Problems and Solutions