【问题标题】:Changing the transparent background behind Dialog更改 Dialog 背后的透明背景
【发布时间】:2012-01-30 15:32:57
【问题描述】:

如何更改对话框后面显示的半透明背景的颜色。 默认为黑色,我想将其设为白色(与默认相同的 alpha)

这是我用于自定义对话框的主题:

另一个问题 - 如何使对话框填充屏幕宽度(每边有 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>

【问题讨论】:

    标签: android dialog


    【解决方案1】:

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

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

    这可能有助于背景:您必须覆盖主题/样式 Android Custom PopupWindow/Dialog

    【讨论】:

    猜你喜欢
    • 2023-03-30
    • 1970-01-01
    • 2013-08-02
    • 2018-04-25
    • 2012-09-18
    • 2018-08-15
    • 1970-01-01
    • 2011-03-08
    • 2021-10-08
    相关资源
    最近更新 更多