0

I want to set the color of the week background by passing specific date.

 public void initializeCalendar(int year, int month, int day) {
    calendar = (CalendarView) findViewById(R.id.calendar);


    // sets whether to show the week number.
    calendar.setShowWeekNumber(false);

    // sets the first day of week according to Calendar.
    // here we set Monday as the first day of the Calendar

    //The background color for the selected week.
    calendar.setSelectedWeekBackgroundColor(getResources().getColor(R.color.green));

    //sets the color for the dates of an unfocused month. 
    calendar.setUnfocusedMonthDateColor(getResources().getColor(R.color.peach));



    //sets the color for the separator line between weeks.
    calendar.setWeekSeparatorLineColor(getResources().getColor(R.color.blue));

}

how will i set the background of the specific week.

Eli Tamondong
  • 51
  • 1
  • 2
  • 7

1 Answers1

0

Use setDate property to a particular day in the specific week you want, and then then use the setSelectedWeekBackgroundColor property to set the background color. for example:

Calendar selectedday = new GregorianCalendar(2015,Calendar.AUGUST , 2);
calender.setDate(selectedday.getTimeInMillis());
calendar.setSelectedWeekBackgroundColor(getResources().getColor(R.color.green));
uchman21
  • 678
  • 3
  • 6
  • 22