本文整理汇总了Java中android.widget.CalendarView.setWeekSeparatorLineColor方法的典型用法代码示例。如果您正苦于以下问题:Java CalendarView.setWeekSeparatorLineColor方法的具体用法?Java CalendarView.setWeekSeparatorLineColor怎么用?Java CalendarView.setWeekSeparatorLineColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CalendarView
的用法示例。
在下文中一共展示了CalendarView.setWeekSeparatorLineColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeCalendar
import android.widget.CalendarView; //导入方法依赖的package包/类
public void initializeCalendar() {
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
calendar.setFirstDayOfWeek(2);
//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.transparent));
//sets the color for the separator line between weeks.
calendar.setWeekSeparatorLineColor(getResources().getColor(R.color.transparent));
//sets the color for the vertical bar shown at the beginning and at the end of the selected date.
calendar.setSelectedDateVerticalBar(R.color.darkgreen);
//sets the listener to be notified upon selected date change.
calendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
//show the selected date as a toast
@Override
public void onSelectedDayChange(CalendarView view, int year, int month, int day) {
Toast.makeText(getApplicationContext(), day + "/" + month + "/" + year, Toast.LENGTH_LONG).show();
}
});
}
示例2: initializeCalendar
import android.widget.CalendarView; //导入方法依赖的package包/类
public void initializeCalendar() {
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 Sunday as the first day of the Calendar
calendar.setFirstDayOfWeek(1);
//The background color for the selected week.
calendar.setSelectedWeekBackgroundColor(getResources().getColor(R.color.light_yellow));
//sets the color for the dates of an unfocused month.
calendar.setUnfocusedMonthDateColor(getResources().getColor(R.color.transparent));
//sets the color for the separator line between weeks.
calendar.setWeekSeparatorLineColor(getResources().getColor(R.color.transparent));
//sets the color for the vertical bar shown at the beginning and at the end of the selected date.
calendar.setSelectedDateVerticalBar(R.color.light_yellow);
calendar.setClickable(true);
/*
calendar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("Info", "CLICKCKCKC");
Date date = new Date(calendar.getDate());
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setTime(date);
int day = cal.get(java.util.Calendar.DAY_OF_MONTH);
int month = cal.get(java.util.Calendar.MONTH);
int year = cal.get(java.util.Calendar.YEAR);
Toast.makeText(getApplicationContext(), day + "/" + month + "/" + year, Toast.LENGTH_LONG).show();
Intent intent = new Intent("com.thunderpanther.panther.DayViewActivity");
if(taskSelected == true) {
intent.putExtra("id", selectedTask.id);
intent.putExtra("name", selectedTask.name);
intent.putExtra("depth", selectedTask.depth);
Log.d("cal", "taskSelected: " + selectedTask.name);
selectedTask = null;
taskSelected = false;
} else {
intent.putExtra("id", -1);
}
intent.putExtra("year", year);
intent.putExtra("month", month);
intent.putExtra("day", day);
startActivity(intent);
}
});
*/
//sets the listener to be notified upon selected date change.
calendar.setOnDateChangeListener(new OnDateChangeListener() {
//show the selected date as a toast
@Override
public void onSelectedDayChange(CalendarView view, int year, int month, int day) {
Toast.makeText(getApplicationContext(), day + "/" + month + "/" + year, Toast.LENGTH_LONG).show();
Intent intent = new Intent("com.thunderpanther.panther.DayViewActivity");
if(taskSelected == true) {
intent.putExtra("id", selectedTask.id);
intent.putExtra("name", selectedTask.name);
intent.putExtra("depth", selectedTask.depth);
Log.d("cal", "taskSelected: " + selectedTask.name);
selectedTask = null;
taskSelected = false;
} else {
intent.putExtra("id", -1);
}
intent.putExtra("year", year);
intent.putExtra("month", month);
intent.putExtra("day", day);
startActivity(intent);
}
});
}