日期选取器与取消android的选项 [英] Date Picker with cancel option in android

查看:145
本文介绍了日期选取器与取消android的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能有一个日期/时间选择器,有在地方一组命令的取消/设置选项。我用例是,当我点击日期选择器和场不是强制性的,我可能要清除选定的数值。我的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.

这篇关于日期选取器与取消android的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆