CalendarView minimum date

扶醉桌前 提交于 2019-11-29 17:58:50

Try calculating the date like this:

Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DATE,Calendar.getInstance().getActualMinimum(Calendar.DATE));
long date = calendar.getTime().getTime();

and set this as minimum date:

calendar_view.setMinDate(date);

since calendar_view.setMinDate(date) needs long value that represents milliseconds.

calendar_view.setMinDate((new Date().getTime()));

works just fine

You can just set the min date as below.

 Calendar c = Calendar.getInstance();
 CalendarView cv = (CalendarView)findViewById(R.id.calendarView);
 cv.setMinDate(c.getTimeInMillis());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!