如何解决错误选择当前日期的自定义日历视图库问题?

How to solve Custom-Calendar-View Library issue for wrong selected current date?

如果您在 android 应用程序中使用 Custom-Calendar-View 库 你会面对这个 issue 移动到上个月时,上个月当前日期的相同位置也设置为选中。

经过长时间的代码跟踪,我解决了它。找到下面的解决方案非常简单 只是把一条线移到另一个地方。

在 class CustomCalendarView.java

中的 setDaysInCalendar() 方法中进行以下更改
private void setDaysInCalendar() {

...

移动这条线

   //Set the current day color
   markDayAsCurrentDay(startCalendar);

 if (isSameMonth(calendar, startCalendar)) {
                dayOfMonthContainer.setOnClickListener(onDayOfMonthClickListener);
                dayView.setBackgroundColor(calendarBackgroundColor);
                dayView.setTextColor(dayOfWeekTextColor);

       // to here
      //Set the current day color
       markDayAsCurrentDay(startCalendar);

    } else {
                dayView.setBackgroundColor(disabledDayBackgroundColor);
                dayView.setTextColor(disabledDayTextColor);

                if (!isOverflowDateVisible())
                    dayView.setVisibility(View.GONE);
                else if (i >= 36 && ((float) monthEndIndex / 7.0f) >= 1) {
                    dayView.setVisibility(View.GONE);
                }
            }

...