覆盖android材质设计警报对话框

时间:2014-12-29 20:25:46

标签: java android android-5.0-lollipop

我正在尝试通过设置主题的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

没有运气。

1 个答案:

答案 0 :(得分:1)

解决方案是从

下降
android:Theme.Material.Light.Dialog.Alert

确定了一切。