Is it possible to change the style of an Android L TimePickerDialog?

JDJ picture JDJ · Jun 27, 2014 · Viewed 36.6k times · Source

I was testing my app on an Android L emulator, and I noticed that the TimePickerDialog has significantly changed to this:

Android L TimePickerDialog

This doesn't fit with the theme of my app, and I wanted to know if it is possible to get the old TimePickerDialog style when running on Android L.

Answer

yehyatt picture yehyatt · Jun 21, 2015

Add android:timePickerMode="spinner" to the XML

    <TimePicker
        android:id="@+id/timePicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:timePickerMode="spinner">
    </TimePicker>

https://developer.android.com/reference/android/R.attr.html#timePickerMode

You can choose between spinner or clock modes. This attribute is only available from API level 21, before that the spinner mode was the only option available.