0

I used this to generate a custom theme for my application (basically just a nice green instead of the default blue)

I have a CheckBox in my app, and it has the green hue applied. I also have textviews, and the underlines are colored correctly.

But if I use

AlertDialog.Builder builder = new AlertDialog.Builder(this);

to build a confirm dialog, the No and Yes buttons critically have the default holo blue - it's really jarring in that everything else in the app is consistently themed.

How can I get to that color and change it? I'd really love to not have to define an entire custom dialog view just to solve this single color problem.

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
Dave
  • 11,392
  • 5
  • 31
  • 42
  • Haven't tried `holo-colors.com/` but you could check their result against [this description](http://stackoverflow.com/a/13762349/1856738), maybe it helps? – class stacker Apr 28 '13 at 11:15

1 Answers1

1

When creating an alert with a custom theme you have to use another constructor:

AlertDialog.Builder(Context context, int theme)

Something like this should be enough:

AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.your_theme);

I would also recommend to use a custom version of DialogFragment and that way you can have all your formatted dialogs in one place. And, on top of that, DialogFragment is automatically restored on rotation ;)

pablisco
  • 14,027
  • 4
  • 48
  • 70