Calendarview通过传参设置周背景颜色
Calendarview set week background color by passing parameter
我想通过指定日期来设置星期背景的颜色。
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));
}
如何设置特定周的背景。
使用 setDate 属性 设置您想要的特定周中的特定日期,然后使用 setSelectedWeekBackgroundColor 属性 设置背景颜色。
例如:
Calendar selectedday = new GregorianCalendar(2015,Calendar.AUGUST , 2);
calender.setDate(selectedday.getTimeInMillis());
calendar.setSelectedWeekBackgroundColor(getResources().getColor(R.color.green));
我想通过指定日期来设置星期背景的颜色。
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));
}
如何设置特定周的背景。
使用 setDate 属性 设置您想要的特定周中的特定日期,然后使用 setSelectedWeekBackgroundColor 属性 设置背景颜色。 例如:
Calendar selectedday = new GregorianCalendar(2015,Calendar.AUGUST , 2);
calender.setDate(selectedday.getTimeInMillis());
calendar.setSelectedWeekBackgroundColor(getResources().getColor(R.color.green));