今天学习了获取系统时间并且使用
DatePicker
标签自由选择时间
<DatePicker android:layout_margin="10dp" android:id="@+id/select_time" android:layout_gravity="center" android:layout_width="300dp" android:layout_height="400dp"/>
DatePicker datePicker; int year; //今年 int month; //当前月份 int day; //今天 //获取当前的年月日 Calendar calendar= Calendar.getInstance(); //获取日历的实例 year=calendar.get(Calendar.YEAR); month=calendar.get(Calendar.MONTH);//实际月份需要加1 day=calendar.get(Calendar.DATE); //监听日期选择器 datePicker=(DatePicker)findViewById(R.id.select_time); datePicker.init(year,month,day,new DatePicker.OnDateChangedListener(){ @Override public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { Log.e("datepicker—你选择的日期是:",year+"-"+(monthOfYear+1)+"-"+dayOfMonth); } });标签:总结,DatePicker,int,每日,month,23.3,year,Calendar,calendar From: https://www.cnblogs.com/laobing6214/p/17201427.html