1 Calendar c=Calendar.getInstance(); 2 //直接创建一个DatePickerDialog对话框实例,并显示出来 3 new DatePickerDialog(this, 4 //绑定监听器 5 new DatePickerDialog.OnDateSetListener() { 6 @Override 7 public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { 8 String text="您选择了:"+year+"年"+(month+1) 9 +"月"+dayOfMonth+"日"; 10 11 12 13 } 14 } 15 //设置初始日期 16 ,c.get(Calendar.YEAR) 17 ,c.get(Calendar.MONTH) 18 ,c.get(Calendar.DAY_OF_MONTH)).show();