【问题标题】:How to restrict user to select current or previous time for Today and select any time for past dates in time picker dialog如何限制用户为今天选择当前或以前的时间,并在时间选择器对话框中选择过去日期的任何时间
【发布时间】:2016-01-16 07:03:22
【问题描述】:

正如我在标题中所写,我想限制用户为今天选择当前或过去的时间,并且可以选择过去日期的任何时间。请告诉我如何在android中执行此操作。我已经通过使用setMaxDate(); 方法对日期选择器添加了限制,但无法在时间选择器中执行相同的操作,所以请告诉我应该怎么做。

【问题讨论】:

  • 你得到答案了吗@Shivam 我在 TimePicker 中也有同样的问题...我想限制用户选择未来的时间

标签: android android-timepicker


【解决方案1】:

试试

setMaxDate(System.currentTimeMillis());

【讨论】:

  • setMaxDate(System.currentTimeMillis());仅适用于日期选择器对话框
猜你喜欢
  • 1970-01-01
  • 2013-06-26
  • 1970-01-01
  • 1970-01-01
  • 2011-04-13
  • 2021-08-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多