TimePicker with Spinners?

user5530425 picture user5530425 · Jan 4, 2016 · Viewed 7.5k times · Source

I'm trying to build a TimePickerDialog but unfortunately the Time Picker that comes up is extremely cumbersome to Use :

enter image description here

Is there any way to build a timepicker like the old ones that Android use to have like below :

enter image description here

My code is as follows :

    ButtonTime.Click += delegate
    {
        ShowTimePickerDialog();
    };

    void ShowTimePickerDialog()
    {
        var dialog = new TimePickerDialogFragment(this, hour, minute, this);

        dialog.Show(FragmentManager, null);
    }

Answer

Abdullah Tahan picture Abdullah Tahan · Jan 9, 2018

adding new xml style

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <style name="SpinnerTimePicker" parent="android:Widget.Material.Light.TimePicker">
    <item name="android:timePickerMode">spinner</item>
  </style>

  <style name="ClockTimePicker" parent="android:Widget.Material.Light.TimePicker">
    <item name="android:timePickerMode">clock</item>
  </style>
</resources>

than set the timepicker style to SpinnerTimePicker in MainTheme

 <item name="android:timePickerStyle">@style/SpinnerTimePicker</item>