Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style buttons in Alert Dialog Fragment using Material Design?

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

The standard Alert Dialog Fragment (in Android L) looks like this:

Default Alert Dialog Fragment

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:

Dialog without borderless button

Does anyone know if this is possible, without recreating the whole dialog from scratch?

like image 677
Jolanda Verhoef Avatar asked Sep 29 '22 14:09

Jolanda Verhoef


1 Answers

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

like image 109
Feng Dai Avatar answered Oct 04 '22 02:10

Feng Dai