0

Is it possible to change the TimePicker colour scheme?

I've tried, but the TimePicker pop-up opens on full screen.

 TimePickerDialog mTimePicker;

    mTimePicker = new TimePickerDialog(AddAlarm.this,R.style.Time_picker, new TimePickerDialog.OnTimeSetListener() {
        @Override
        public void onTimeSet(TimePicker timePicker, int selectedHourLocal, int selectedMinuteLocal) {

        }
    }, hour, minute, false);//Yes 24 hour time
    mTimePicker.setTitle("Select Time");
    mTimePicker.show();

And the style is

 <style name="Time_picker">
    <item name="android:numbersTextColor" tools:targetApi="lollipop">#ffffff</item>
    <item name="android:numbersBackgroundColor" tools:targetApi="lollipop">#643B85</item>
    <item name="android:numbersSelectorColor" tools:targetApi="lollipop">#88000000</item>
    <item name="android:headerBackground">#643B85</item>
</style>
jkdev
  • 11,360
  • 15
  • 54
  • 77
  • http://developer.android.com/reference/android/app/TimePickerDialog.html#TimePickerDialog(android.content.Context,%20int,%20android.app.TimePickerDialog.OnTimeSetListener,%20int,%20int,%20boolean) – Sree Aug 13 '15 at 09:48
  • Related: http://stackoverflow.com/a/39407384/5151608 – jkdev Sep 16 '16 at 15:33

1 Answers1

0

Use one of the five built-in AlertDialog themes:

THEME_TRADITIONAL - The traditional (pre-Holo) alert dialog theme

THEME_HOLO_DARK - The holographic alert theme with a dark background

THEME_HOLO_LIGHT - The holographic alert theme with a light background

THEME_DEVICE_DEFAULT_DARK - The device's default alert theme with a dark background.

THEME_DEVICE_DEFAULT_LIGHT - The device's default alert theme with a light background.

For instance:

       MyTimePickerDialog timePickerDialog = new MyTimePickerDialog (AddAlarm.this,
        TimePickerDialog.THEME_HOLO_DARK, timeSetListener, 0, 0, true);
sasikumar
  • 12,540
  • 3
  • 28
  • 48
  • can you able to explain what is MyTimePickerDialog in your code ? – Sree Aug 13 '15 at 09:54
  • https://github.com/benjholla/Android-Applications/blob/master/Android%20Applications/WebSMS/WebSMS/src/de/ub0r/android/websms/MyTimePickerDialog.java – sasikumar Aug 13 '15 at 09:59