Android TimePicker - 当时间在 12 小时模式下超过 12 点时如何更改为 AM/PM?
当用户单击 TimePicker 视图的“+”或“-”按钮并且时间超过 12 时,是否有办法将时间从 AM 更改为 PM(反之亦然)?
我举个例子 - 如果现在时间是上午 11 点,并且用户单击 TimePicker 的“+”按钮,时间将更改为上午 12 点(应该更改为下午 12 点)。
有办法做到这一点吗?为什么 TimePicker 不这样做呢?
由于这个问题,我收到了很多用户的愤怒回应。
任何帮助都可以, 谢谢
Is there a way to change the time from AM to PM(and vice versa) when the user clicks the '+' or '-' buttons of a TimePicker View, and the time gets past 12?
I'll give an example - If the time now is 11 AM, and the user clicks the '+' button of the TimePicker, the time changes to 12 AM(where it should change to 12 PM).
Is there a way of doing that? Why isn't the TimePicker doing it anyway?
I'm getting a lot of angry responses from my users because of this issue.
Any help will do,
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用侦听器,跟踪当前时间,然后在
onTimeChanged
方法,您可以检测翻转并自行更改 AM/PM 设置。You could use a listener, keep track of the current time and then in the
onTimeChanged
method you could detect the roll over and change the AM/PM settings yourself.尝试 setIs24HourView(Boolean is24HourView) 方法?它将删除 AM/PM,但至少时间将处于 24 小时模式。
Try the
setIs24HourView(Boolean is24HourView)
method? It will remove AM/PM but at least the times will be in 24h mode.