Closed Axemasta closed 1 year ago
What should the time picker look like in 12 hour mode?
It looks like the time picker in your screenshot is 12 hour mode, because it offers "am" and "pm" options. I would assume if it was 24 hour mode those choices would not be available.
If the actual issue is that you can't set timePickerMode
to spinner
from code, that seems to be something that Google is aware of and has chosen not to implement:
What should the time picker look like in 12 hour mode?
In 12 hour it looked like:
In 24 hour it looked like the normal time picker ui we see in xamarin android / maui etc:
https://issuetracker.google.com/issues/37084372 This is for the
TimePickerDialog
not theTimePicker
itself, although that seems like an absolute stinker of a decision from google to not fix.
😡
I tried subclassing TimePicker
and overriding Is24HourView
, still the undesired behaviour. I guess I'll have to use an axml
file instead for this view which is... annoying 😬
Thanks for the help anyway!
I think is24HourView
and timePickerMode
are unrelated. Both pictures show 12 hour views. What you want is timePickerMode
= spinner
instead of clock
.
It does not appear timePickerMode
can be set via code per Google.
For example, a 24 hour "clock"
TimePicker
would look like this:
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
net7.0-android
Description
Using the
Android.Widget.TimePicker
and trying to set it to scroll mode (12 hour) doesn't appear to work.The use case is a custom view handler for a maui control. I tried the following axml in a file new android studio app:
Which displays our nice scrolly time picker:
The
TimePickerMode
api appears to be missing in code, but it is documented as an xml property here.In my Maui handler, I have the following layout:
As you can see, the time picker is still in 24 hour format.
Steps to Reproduce
This is reproduced in my proof of concept datetimepicker control repo (link). Run the sample and observe the code in the
MauiDateTimePicker
native view not being respected (link).Did you find any workaround?
No
Relevant log output