1

I'm using the DatePickerDialog in android and trying to change the colors of it when it pops up. I can change the button text color but can't seem to find a way to change the other colors. Here's a picture to illustrate:

enter image description here

Outlined in black are the areas that I would to change to blue. Anything that is green I would like to change to blue. Also here is the code I used to change button text color:

Calendar c = Calendar.getInstance();
                        int mYear = c.get(Calendar.YEAR);
                        int mMonth = c.get(Calendar.MONTH);
                        int mDay = c.get(Calendar.DAY_OF_MONTH);
                        //System.out.println("the selected " + mDay);
                        DatePickerDialog dialog = new DatePickerDialog(MainActivity.this,
                                new mDateSetListener(), mYear, mMonth, mDay);

                        dialog.show();

                        Button ok = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
                        ok.setTextColor(Color.rgb(64, 131, 207));

                        Button cancel = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
                        cancel.setTextColor(Color.rgb(64, 131, 207));

Is there a way to change these colors or a general color style that I can change? Everything defaults to that darker green color. Any help would be appreciated. Thank you.

user112016322
  • 688
  • 3
  • 11
  • 26
  • 1
    I have gone down this path before and I am just warning you the UI identifiers change with the Android OS so it will be hard to find a universal solution unless you create your own DatePickerDialog. I had an application that worked great in Lollipop and broke when I first ran it on Android M. – AdamMc331 Dec 22 '15 at 16:53

1 Answers1

0

I am not sure if the default color of DatePickerDialog can be changed but you can use the holoeverywhere library which would not only make your DatePickerDialog look good but the entire app as a whole look good. Here you can find how to get the library in your android studio.

Community
  • 1
  • 1
Parag Kadam
  • 3,620
  • 5
  • 25
  • 51