我正在使用更好的选择器库(here's the link)来在我的应用程序中选择日期。我想为选择器设置限制,使得最大日期是今天的日期,最小日期不超过一年。这是我的代码,用于显示 CalendarDatePickerDialogFragment 对话框;
private void showDateDialog() {
FragmentManager fm = getSupportFragmentManager();
DateTime now = DateTime.now();
CalendarDatePickerDialogFragment calendarDatePickerDialogFragment = CalendarDatePickerDialogFragment
.newInstance(this, now.getYear(), now.getMonthOfYear() - 1,
now.getDayOfMonth());
calendarDatePickerDialogFragment.show(fm, FRAG_TAG_DATE_PICKER);
}