How to show only a specific month on Android CalendarView?

血红的双手。 提交于 2019-12-06 02:09:34
Calendar febFirst=Calendar.getInstance();

febFirst.set(2017, 1, 1, 0, 0, 0);

calendar.setMinDate(febFirst.getTimeInMillis());

Calendar febLast=Calendar.getInstance();

febLast.set(2017, 2, 0, 0, 0, 0);

calendar.setMaxDate(febLast.getTimeInMillis());
calendar.setDate(febFirst.getTimeInMillis());

where calendar is the CalendarView.

int day = 16;
int month =8;
int year =2017;
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DAY_OF_MONTH, day);
     long milliTime = calendar.getTimeInMillis();
mCalendarView.setDate (milliTime, true, true); 

Here mCalendarView is the Android calendar view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!