废话不多说了,直接给大家贴代码了,具体代码如下所示:
//出生年月设置 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(); }
共0条 [查看全部]相关评论