在
void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth);
方法里面可以设置当前显示的时间,后面三个参数。但是月份是不可以设置为12月的。查看源码才发现,只能是0-11。
public interface OnDateSetListener {
/**
* @param view The view associated with this listener.
* @param year The year that was set.
* @param monthOfYear The month that was set (0-11) for compatibility
* with {@link java.util.Calendar}.
* @param dayOfMonth The day of the month that was set.
*/
void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth);
}