public class QuickIWantActivity extends Activity implements
OnDateSetListener {
.....
.....
.....
dateET.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Calendar cal = Calendar.getInstance();
DatePickerDialog datePickDiag = new DatePickerDialog(
QuickIWantActivity.this, QuickIWantActivity.this, cal
.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH));
datePickDiag.show();
return true;
}
});
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
int month = monthOfYear + 1;
dateET.setText(dayOfMonth + "- " + month + "- " + year);
}
}
因此,在触摸作为 EditText 的 dateET 时,它会打开日期选择器,我设置新日期并单击设置,它不会被解除,我再次单击设置,即使现在它也不会被解除,最后当我单击设置时它会被解除第三次