Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove border, padding from Dialog

I have an activity which is with the theme Theme.Transparent which is:

<style name="Theme.Transparent" parent="android:Theme.Dialog">     <item name="android:windowIsTranslucent">true</item>     <item name="android:windowNoTitle">false</item>     <item name="android:windowIsFloating">true</item>     <item name="android:backgroundDimEnabled">false</item>     <item name="android:gravity">top</item> </style> 

i'm trying to get rid of the border and the padding around it.. i want to make fill the horizontal of the screen. and no gray border. please help :) enter image description here

like image 359
Guy Avatar asked Jan 12 '12 14:01

Guy


1 Answers

Be sure to create your Dialog referencing your custom theme:

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

Your custom theme needs to fill the screen and disable a couple of Android framework defaults:

<?xml version="1.0" encoding="utf-8"?> <resources>     <style name="MyDialogTheme" parent="android:Theme.Dialog">         <!-- Fill the screen -->         <item name="android:layout_width">fill_parent</item>         <item name="android:layout_height">fill_parent</item>          <!-- No backgrounds, titles or window float -->         <item name="android:windowBackground">@null</item>         <item name="android:windowNoTitle">true</item>         <item name="android:windowIsFloating">false</item>                <!-- Just to prove it's working -->         <item name="android:background">#ff0000</item>     </style>  </resources> 
like image 122
David Snabel-Caunt Avatar answered Sep 21 '22 21:09

David Snabel-Caunt