TimePickerDialog timePickerDialog = new TimePickerDialog.Builder() .setCallBack(new OnDateSetListener() { @Override public void onDateSet(TimePickerDialog timePickerView, long millseconds) { Date date = new Date(millseconds); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String time = format.format(date); mAutxtIntime.setText(time); } }) .setCancelStringId("取消") .setSureStringId("确定") .setTitleStringId("选择") .setYearText("年") .setMonthText("月") .setDayText("日") .setCyclic(false) .setMinMillseconds(getMills()) //设置能获取的最小值getMills()是获取时间毫秒值 .setMaxMillseconds(System.currentTimeMillis() ) //设置能到达的最大值 .setCurrentMillseconds(System.currentTimeMillis()) //设置当前时间 .setThemeColor(getResources().getColor(R.color.timepicker_dialog_bg)) .setType(Type.YEAR_MONTH_DAY) .setWheelItemTextNormalColor(getResources().getColor(R.color.timetimepicker_default_text_color)) .setWheelItemTextSelectorColor(getResources().getColor(R.color.timepicker_toolbar_bg)) .setWheelItemTextSize(12) .build(); timePickerDialog.show(getSupportFragmentManager(), "YEAR_MONTH_DAY");
TimePickerDialog使用
最新推荐文章于 2021-04-13 16:57:48 发布