@OnTouch(R.id.edt_wjzhcx_wjzh_ngrqq) public boolean setNgrqq(View view, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { final Calendar c = Calendar.getInstance(); new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int i, int i1, int i2) { //转换下格式2017-9-26------>2017-09-26 edtWjzhcxWjzhNgrqq.setText(DateUtil.convertDate(i + "-" + (i1 + 1) + "-" + i2, "yyyy-MM-dd", "yyyy-MM-dd")); datePicker.setMaxDate(c.getTime().getTime());//设置最大日期 } }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show(); return true; } return false; }