2012-01-30 83 views
0

如何更改显示在对话框后面的半透明背景的颜色。 默认是黑色的,我希望把它的白色(与喜欢默认的相同的阿尔法)更改对话框背后的透明背景

这是我用我的定制对话框主题:

另一个问题 - 我怎么能使对话框填充屏幕宽度(每边有20dp的余量)

<?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> 

回答

0

制作xml布局并将布局设置为对话框。

这可能有助于对语法:你必须在对话框的内容设置为布局 http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application

这可能有助于为背景:你必须重写时得知 Android Custom PopupWindow/Dialog

+0

甚至覆盖的主题/风格主题 - 我没有找到任何参数,负责半透明图层的颜色,弹出 – 2012-02-06 11:03:05

+0

http://stackoverflow.com/questions/3118601/how-can-i-change-the-background -of-Android的警报的对话框 – AJcodez 2012-02-06 14:22:29