I was testing my app on an Android L emulator, and I noticed that the TimePickerDialog has significantly changed to this:
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.
Add android:timePickerMode="spinner" to the XML
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.
As LordRaydenMK said, use the
TimePickerDialog
constructor withtheme
parameter and provide this theme:android.R.style.CustomDatePickerDialog
And in your
Styles.xml
define this:You can use the TimePickerDialog constructor with
theme
parameter to specify the theme.If you want the AM / PM to be a picker instead of a button then I recommend you use the single parameter constructor with a
ContextThemeWrapper
:If you pass the theme into the multiple parameter constructor then you'll end up with a rather ugly AM / PM button, and the colon will be missing between the hour and minute columns.