Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove border from Dialog?

Tags:

I have an activity which is shown in a dialog:

In order to remove border and rounded corners, i tried this:

<resources>   <style name="ActivityDialog" parent="@android:style/Theme.Dialog">   <item name="android:windowBackground">@null</item>      <item name="android:windowFrame">@null</item> </style> 

The border is gone, but sadly also the margin around the dialog.

like image 836
timoschloesser Avatar asked Nov 08 '11 14:11

timoschloesser


People also ask

How do I remove a layout border?

Go to Design > Page Borders. In the Borders and Shading box, on the Page Border tab, select the arrow next to Apply to and choose the page (or pages) you want to remove the border from. Under Setting, select None, and then select OK.

How do I turn off custom dialog?

You may call dismiss(); on the dialog.


1 Answers

Without creating a custom background drawable and adding a special style just add one line to your code:

dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); 
like image 165
AlexD Avatar answered Sep 18 '22 19:09

AlexD