如何自定义TimePickerDialog?

发布于 2024-09-17 01:33:22 字数 192 浏览 2 评论 0原文

我希望在 Android 中创建一些与 TimePickerDialog (外观和感觉)完全相似的东西,但它会持续几分钟/秒,而不是几小时/分钟。因此,AM/PM 不相关,因此允许 MINUTE 大于 24(最大为 59)。

是否可以以任何方式更改 TimePickerDialog 实例来反映这一点?

任何和所有建议将不胜感激。 :-)

I'm looking to create something EXACTLY like TimePickerDialog (look and feel) in Android, but it would be for MINUTES/SECONDS, not HOURS/MINUTES. Therefore AM/PM would not be relevant and would therefore allow MINUTE to be greater than 24 (making the max 59).

Is it possible to change the TimePickerDialog instance in any way to reflect this?

Any and all suggestions would be greatly appreciated. :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

天邊彩虹 2024-09-24 01:33:31

由于 CommonsWare 的答案中的链接现已失效,您可能想知道 TimePickerDialog 的源代码可能已经在您的本地计算机上 - 它包含在 SDK 中。尝试在以下位置查找:

[SDK_HOME]/sources/android-23/android/app/TimePickerDialog.java
or
[SDK_HOME]/sources/android-23/com/android/datetimepicker/time/TimePickerDialog.java


[SDK_HOME]/platforms/android-23/data/res/layout/time_picker_dialog.xml

当然,选择您要借用的 Android 版本。对 R. 的引用应为 android.R。不幸的是,ValidationCallback 似乎存在一些可见性问题 - 即使在最近的 SDK 级别。

As the links in CommonsWare's answer are now dead, you might want to know that the source for TimePickerDialog is probably already on your local machine - it is included in the SDK. Try looking in the following locations:

[SDK_HOME]/sources/android-23/android/app/TimePickerDialog.java
or
[SDK_HOME]/sources/android-23/com/android/datetimepicker/time/TimePickerDialog.java


[SDK_HOME]/platforms/android-23/data/res/layout/time_picker_dialog.xml

Of course, choose the Android version that you want to borrow from. References to R. should be to android.R. Unfortunately, there seem to be some visibility issues with ValidationCallback - even on recent SDK levels.

情魔剑神 2024-09-24 01:33:29

这可能会有所帮助:

带有秒数的 TimePicker:

https://github.com/IvanKovac/TimePickerWithSeconds

看看。

在此处输入图像描述

This might help:

TimePicker with seconds:

https://github.com/IvanKovac/TimePickerWithSeconds

Have a look.

enter image description here

维持三分热 2024-09-24 01:33:27

是否可以以任何方式更改 TimePickerDialog 实例来反映这一点?

不,但是 布局源代码TimePickerDialog 都可以作为实现您自己的对话框的起点。

Is it possible to change the TimePickerDialog instance in any way to reflect this?

No, but the layout and source code to TimePickerDialog are both available as a starting point for implementing your own dialog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文