【问题标题】:How to avoid dialog using same style with activity?如何避免使用与活动相同的样式进行对话?
【发布时间】:2013-07-26 07:06:11
【问题描述】:

我正在为我的活动使用自定义样式,它也会影响使用该样式的对话框(alertdialog、DatePickerDialog 等)。我怎样才能避免 alertdialog 不使用与活动相同的样式??

这是 style.xml 中的代码:

    <style name="Custom.Theme" parent="@android:style/Theme.Dialog">
        <item name="android:background">@color/cag_white</item>
        <item name="android:textColor">@color/cag_orange</item>
        <item name="android:textViewStyle">@style/Cag.Dialog.TextView</item>
        <item name="android:editTextStyle">@style/Cag.EditText</item>
        <item name="android:buttonStyle">@style/Cag.Button</item>
    </style>

【问题讨论】:

    标签: android dialog styles


    【解决方案1】:

    您可以按照自己的方式为对话框指定主题。查看herehere 中的示例。

    不过,我个人更喜欢使用DialogFragments,并通过onCreateView自己设置样式。

    【讨论】:

    猜你喜欢
    • 2020-10-17
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 1970-01-01
    • 2016-07-25
    • 1970-01-01
    • 1970-01-01
    • 2019-07-25
    相关资源
    最近更新 更多