Calendar(覺得好用記得幫忙Star哦)
注意事項:
該Demo沒有進行網絡資料的聯調,使用了本地資料庫進行存儲資料,有需要網絡配置的可删除本地資料庫相關代碼,再去進行網絡資料顯示即可。
交流QQ群:
小江Android交流群(259194144),進群備注Android、Github之類的關鍵詞即可。
使用方法:
MonthCalendarView的使用
android:id="@+id/mcvCalendar"
android:layout_width="match_parent"
android:layout_height="@dimen/small_month_calendar_height"
app:month_day_text_size="@integer/small_calendar_text_size"
app:month_selected_circle_color="@color/color_select_date_dialog_edit_text_bg_focus"
app:month_selected_circle_today_color="@color/color_select_date_dialog_edit_text_bg_focus"
app:month_show_lunar="true"
app:month_show_task_hint="false"
app:month_show_holiday_hint="true"
app:month_text_size="@integer/small_calendar_text_size"/>
ScheduleLayout的使用
layout_schedule.xml檔案,必須包含MonthCalendarView、WeekCalendarView和ScheduleRecyclerView,可以直接引用改檔案作為布局。
ScheduleLayout:
app:default_view="week"
app:default_view="month"
app:auto_change_month_row="false"
app:auto_change_month_row="true"
設定日期監聽
slSchedule.setOnCalendarClickListener(new OnCalendarClickListener() {
@Override
public void onClickDate(int year, int month, int day) {
//監聽獲得點選的年月日
}
});
跳轉到今天
slSchedule.getMonthCalendar().setTodayToView();
跳轉到某一天
slSchedule.initData(year, month, day);
缺點
該月曆暫時沒有支援無限循環,需要檢視很多日期的朋友可以在MonthAdapter和WeekAdapter調高SIZE的大小即可。
效果圖: