废话不多说了,直接给大家贴代码了,具体代码如下所示:
//出生年月设置 private void birthSetting() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { String month = (monthOfYear + 1) < 10 ? "0" + String.valueOf(monthOfYear + 1) : String.valueOf(monthOfYear + 1); tvBirth.setText(new StringBuilder().append(year).append("-").append(month).append("-").append(dayOfMonth));//tvBirth就是选择日期结果textview } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)).show(); }
本文章地址http://www.vzeo.com/news/xuetang/800900.html 由 友站网 编辑整理,转载请注明出处