嗨我在我的应用程序中对于android是新手我已创建DatePickerDialogue
确定没问题
我的问题是,当我选择当前日期以外的任何日期时,当前日期无法选择
任何人都可以帮助我
public class DatePickerDialogue extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.shared_layout);
int mYear, mMonth, mDay;
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dpd = new DatePickerDialog(DatePickerDialogue.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
}
}, mYear, mMonth, mDay);
dpd.getDatePicker().setMaxDate(System.currentTimeMillis());
dpd.show();
}
}