private void showPickerDialog(String title, String strDatetime) { if (mDialog == null) { mDialog = new PopupWindowDialog(mPathActivity); mDialog.setContentView(R.layout.datetime_picker); } View view = mDialog.getContentView(); { view.findViewById(R.id.datetime_picker_close).setOnClickListener(this); view.findViewById(R.id.datetime_picker_cancel).setOnClickListener(this); view.findViewById(R.id.datetime_picker_submit).setOnClickListener(this); } TextView lblTitle = (TextView) view.findViewById(R.id.datetime_picker_title); datetime_picker_date = (DatePicker) view.findViewById(R.id.datetime_picker_date); datetime_picker_time = (TimePicker) view.findViewById(R.id.datetime_picker_time); lblTitle.setText(title); DateTime datetime = DateTime.from(strDatetime, "yyyy-MM-dd HH:mm"); datetime_picker_date.init( datetime.getYear(), datetime.getMonth(), datetime.getDay(), null); // date.getDay() // pkrTime.setIs24HourView(true);// 24小时制 datetime_picker_time.setCurrentHour(datetime.getHours()); // 设置当前小时。 datetime_picker_time.setCurrentMinute(datetime.getMinutes()); // 当前分钟 // datetime_picker_time.setOnTimeChangedListener(null); mDialog.show(); }
private void hidePickerDialog() { mDialog.destroy(); }