是否有可能有一个日期/时间选择器,有在地方一组命令的取消/设置选项。我用例是,当我点击日期选择器和场不是强制性的,我可能要清除选定的数值。我的code看起来是这样的:
私人DatePickerDialog日期选择器= NULL;
日期选择器=新DatePickerDialog(的getContext(),新DateSetListener()年,monthOfYear,DAYOFMONTH);
解决方案
有一个问题与DatePickerDialog和TimePickerDialog(问题#34833)。我们可以用一个计数器作为一个变通摆脱这个问题。
Is it possible to have a date/time picker that has a Cancel/Set options in place of a single Set command. My usecase is that when i click on the date picker and the field is not mandatory, i might want to clear the selected value. My code looks something like this :
private DatePickerDialog datePicker = null;
datePicker = new DatePickerDialog(getContext(), new DateSetListener(), year, monthOfYear, dayOfMonth);
解决方案
There is an issue with the DatePickerDialog and the TimePickerDialog (Issue #34833). We could use a counter as a work-around to get rid of this issue.