how to change the particular date text color in calendar view using android?

4.7k views Asked by At

I am using a calendar view in Android. I am trying to change a particular text colour in calendar view but I am not able to find a method like setSelectedDateTextColor(int color). Please tell me how to achieve this.

1

There are 1 answers

0
Hardik Parmar On

it's perfect work for me. just try it.

    private void initializeCalendar() {
    // TODO Auto-generated method stub
    CalendarView cvCalendar = null;
    cvCalendar.setShowWeekNumber(false);
    cvCalendar.setFirstDayOfWeek(1);
    cvCalendar.setSelectedWeekBackgroundColor(getResources().getColor(
            R.color.darkgray));
    cvCalendar.setUnfocusedMonthDateColor(getResources().getColor(
            R.color.darkgray));
    cvCalendar.setWeekSeparatorLineColor(getResources().getColor(
            R.color.white));
    cvCalendar.setSelectedDateVerticalBar(R.color.white);
    cvCalendar.setSelected(false);
    cvCalendar.setOnDateChangeListener(new OnDateChangeListener() {

        @Override
        public void onSelectedDayChange(CalendarView view, int year,
                int month, int day) {
            // TODO Auto-generated method stub
            // cvCalendar.canScrollVertically(day);

            Calendar c = Calendar.getInstance();
            c.set(year, month, day);
            month = month + 1;

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            formattedDate = sdf.format(c.getTime());

        }
    });

}