badoualy / datepicker-timeline

An infinite scrolling timeline to pick a date
MIT License
464 stars 71 forks source link

how to set different color for labels #29

Open ghost opened 5 years ago

ghost commented 5 years ago

i wanna to change labels in different days but the application crash

mCalendarView.setDateLabelAdapter(new MonthView.DateLabelAdapter() { @Override public CharSequence getLabel(Calendar calendar, int index) { if (calendar.get(Calendar.DATE) == 5) { mCalendarView.getTimelineView().setLabelColor(getResources().getColor(R.color.red_50));

                return "busy";
            }else
                return Integer.toString(calendar.get(Calendar.MONTH) + 1) + "/" + 
                           (calendar.get(Calendar.YEAR) % 2000);
        }
    });
    mCalendarView.getTimelineView().getAdapter().notifyDataSetChanged();