日期范围:2015/07/08至今
Calendar calendar=Calendar.getInstance();
DatePickerDialog dialog=new DatePickerDialog(HistoryActivity.this,
R.style.MyDatePickerDialogTheme,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year,
int monthOfYear, int dayOfMonth) {
String s=Integer.toString(year)+Integer.toString(monthOfYear)+Integer.toString(dayOfMonth);
historyWeather.setText(s);
}
},calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH));
//设置起始日期和结束日期
DatePicker datePicker = dialog.getDatePicker();
Date date = new Date("2015/07/08 00:00:01");//当前时间
long time = date.getTime();
datePicker.setMinDate(time);
datePicker.setMaxDate(System.currentTimeMillis());
dialog.show();
效果图: