废话不多说了,直接给大家贴代码了,具体代码如下所示:
//出生年月设置 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(); }
- 看不过瘾?点击下面链接!
- django基础之数据库操作方法教程
- Nginx 实现灰度发布的三种方法
- Java多线程并发编程Synchronized关键字
- Java多线程并发编程 Volatile关键字
- 101个MySQL调试与优化技巧汇总
- Bootstrap多级菜单的实现代码详解