动态日期选择器Android

时间:2016-08-10 11:02:34

标签: android android-datepicker

我需要开发一个应用程序,要求用户在日历

中选择多个日期
Override
    protected Dialog onCreateDialog(int id) {
        // TODO Auto-generated method stub

        Calendar cal = Calendar.getInstance();
        DatePickerDialog datePicker = new DatePickerDialog(DatePicker.this,new DatePickerDialog.OnDateSetListener() {

            @Override
            public void onDateSet(DatePicker view, int year, int monthOfYear,
                                  int dayOfMonth) {
                EditText edt_Bdate=(EditText)findViewById(id);
                edt_Bdate.setText(year+"-"+(monthOfYear+1)+"-"+dayOfMonth);


            }
        },cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
                cal.get(Calendar.DAY_OF_MONTH));
        return datePicker;
    }
}

但不推荐使用此代码

0 个答案:

没有答案