如何自定义TimePickerDialog?
我希望在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于 CommonsWare 的答案中的链接现已失效,您可能想知道 TimePickerDialog 的源代码可能已经在您的本地计算机上 - 它包含在 SDK 中。尝试在以下位置查找:
当然,选择您要借用的 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:
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.
这可能会有所帮助:
带有秒数的 TimePicker:
https://github.com/IvanKovac/TimePickerWithSeconds
看看。
This might help:
TimePicker with seconds:
https://github.com/IvanKovac/TimePickerWithSeconds
Have a look.
不,但是 布局 和 源代码 到
TimePickerDialog
都可以作为实现您自己的对话框的起点。No, but the layout and source code to
TimePickerDialog
are both available as a starting point for implementing your own dialog.