1

How can I change the color of the semi-transparent background that is shown behind a Dialog. The default is black and I want to make it white (with the same alpha like the default)

This is the theme I'm using for my custom dialog:

another question - how can I make the dialog to fill the screen width (with 20dp margin on each side)

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CustomDialogTheme" parent="android:Theme.Dialog">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">fill_parent</item>
        <item name="android:padding">30dp</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:background">@color/white</item>
   </style>
</resources>
Yaron U.
  • 7,681
  • 3
  • 31
  • 45

1 Answers1

0

Make a xml layout and set the layout to the dialog.

This might help for the syntax: you must set the content of the dialog to a layout http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application

This might help for the background: you must overwrite the theme/style Android Custom PopupWindow/Dialog

Community
  • 1
  • 1
AJcodez
  • 31,780
  • 20
  • 84
  • 118
  • even when overwriting the theme - i didn't find any parameter that is responsible for the color of the half transparent layer that appears behind the popup – Yaron U. Feb 06 '12 at 11:03
  • http://stackoverflow.com/questions/3118601/how-can-i-change-the-background-of-android-alert-dialogs – AJcodez Feb 06 '12 at 14:22