如何使用材质设计的“警报对话框”片段中的样式按钮? [英] How to style buttons in Alert Dialog Fragment using Material Design?

查看:337
本文介绍了如何使用材质设计的“警报对话框”片段中的样式按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在警报对话框中更改默认按钮样式。



标准警报对话框片段(在Android L中)如下所示:





我希望将正确的按钮设为普通按钮,而不是无边框按钮。 Google本身似乎在各种对话框中使用此模式,例如:




$ b

class =h2_lin>解决方案

您可以使用属性来设计主题中的按钮: android:buttonBarPositiveButtonStyle android :buttonBarNegativeButtonStyle ,和 android:buttonBarNeutralButtonStyle


I'd like to change the default button styling on an alert dialog.

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?

解决方案

You can style the button in the theme with attributes: android:buttonBarPositiveButtonStyle, android:buttonBarNegativeButtonStyle, and android:buttonBarNeutralButtonStyle.

这篇关于如何使用材质设计的“警报对话框”片段中的样式按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆