如何使用样式材料设计在警报对话框片段按钮? [英] How to style buttons in Alert Dialog Fragment using Material Design?
问题描述
我想改变一个警告对话框的默认按钮样式。
I'd like to change the default button styling on an alert dialog.
标准警报对话框片段(Android中L)是这样的:
The standard Alert Dialog Fragment (in Android L) looks like this:
我想向右按钮的样式作为一个正常的按钮而不是一个无国界的按钮。谷歌本身似乎使用各种对话框,如以下模式:
I'd like the right button to be styled as a normal button instead of a borderless button. Google itself seems to use this pattern in various dialogs, such as:
有谁知道这是可能的,无需从头开始重建整个对话?
Does anyone know if this is possible, without recreating the whole dialog from scratch?
推荐答案
您可以在属性主题风格的按钮:的android:buttonBarPositiveButtonStyle
, Android的:buttonBarNegativeButtonStyle
和的android:buttonBarNeutralButtonStyle
You can style the button in the theme with attributes: android:buttonBarPositiveButtonStyle
, android:buttonBarNegativeButtonStyle
, and android:buttonBarNeutralButtonStyle
.
这篇关于如何使用样式材料设计在警报对话框片段按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!