【问题标题】:Overriding android material design alert dialogs覆盖android材料设计警报对话框
【发布时间】:2015-02-26 00:45:14
【问题描述】:

我正在尝试通过设置我的主题的 alertDialogTheme 属性来更改 android L 警报对话框上“取消”按钮的颜色,如下所示:

<item name="android:alertDialogTheme">@style/AlertDialogStyle</item>

现在 AlertDialogStyle 为空:

<style name="AlertDialogStyle" parent="android:style/Theme.Material.Light.Dialog">

</style>

我知道我可以使用

android:buttonBarNegativeButtonStyle

属性来更新这些按钮的颜色/样式。我遇到的问题是,通过从 Theme.Material.Light.Dialog 样式下降,我所有的对话框的宽度都减小到(看起来是)wrap_content。我有一些自定义的警报对话框,而且这个宽度看起来很糟糕。有没有人遇到过这个问题,如果有,有人解决了吗?

编辑:我也尝试将父级设置为

android:Theme.Material.Light.Dialog

没有运气。

【问题讨论】:

    标签: java android android-5.0-lollipop


    【解决方案1】:

    解决办法是从

    android:Theme.Material.Light.Dialog.Alert
    

    这一切都解决了。

    【讨论】:

      猜你喜欢
      • 2015-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多