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();

 

相关文章:

  • 2021-11-20
  • 2021-12-09
  • 2022-12-23
  • 2021-07-07
  • 2021-11-07
  • 2021-04-03
猜你喜欢
  • 2021-10-16
  • 2021-08-18
  • 2021-12-07
  • 2021-11-27
  • 2021-12-12
  • 2021-11-20
相关资源
相似解决方案