Android DatePicker /对话框使用最小/最大日期显示不正确的月份 [英] Android DatePicker/Dialog displaying incorrect month/s using min/max date

查看:553
本文介绍了Android DatePicker /对话框使用最小/最大日期显示不正确的月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DatePickerDialog和DatePicker设置一个特定的范围。

I'm using the DatePickerDialog and the DatePicker to set a specific range.

datePicker.setMinDate(minDate);
datePicker.setMaxDate(maxDate);

如果我的最小/最大 - 日期在一个月的范围内(例如:7.2.2014 - 27.2.2014),我仍然在对话框中显示邻居月份(Jan,Mar)。
如果我选择上个月(Jan),该对话框将自动切换到minDate,并且该月份将切换回二月份。未来一个月的相同事情。

If my min/max - dates are in the range of one month (eg.: 7.2.2014 - 27.2.2014), i still get the neighbour months displayed in the dialog (Jan, Mar). If i choose the last month (Jan), the dialog automatically swaps to the minDate and the month switches back to Feb. Same thing for the future month.

有没有办法要解决这个问题,所以我只能收到显示的月份,这在我的范围内?

Is there a way to fix this, so that i only get the months displayed, which are in my range?

推荐答案

.....

所以你必须在1月份使用零,11月使用零。

So u have to use zero for january and 11 for December

这篇关于Android DatePicker /对话框使用最小/最大日期显示不正确的月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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