TimePicker 的显示问题:只能选择当前时间

Display issue with TimePicker: Only current time is selectable

我想显示一个 TimePicker,所有时间段都可供 select 使用。但对我来说只有当前时间之后的时间段可供select使用。

请检查我的代码。

        final Calendar now = Calendar.getInstance();
        TimePickerDialog timePickerDialog = new TimePickerDialog();
        timePickerDialog.initialize(new TimePickerDialog.OnTimeSetListener() {
            @Override
            public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
                now.set(Calendar.HOUR_OF_DAY, 0);
                now.set(Calendar.MINUTE, 0);
                now.set(Calendar.SECOND, 0);
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm a");
                String selectedDateString = simpleDateFormat.format(now.getTime());


                tvTimePicker.setText(selectedDateString);


            }
        }, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), now.get(Calendar.SECOND), false);

        Calendar minNowCalendar = Calendar.getInstance();
        timePickerDialog.setMinTime(minNowCalendar.get(Calendar.HOUR_OF_DAY), minNowCalendar.get(Calendar.MINUTE), minNowCalendar.get(Calendar.SECOND));


        timePickerDialog.show(getActivity().getFragmentManager(),"Key");

删除这一行:

timePickerDialog.setMinTime(minNowCalendar.get(Calendar.HOUR_OF_DAY), minNowCalendar.get(Calendar.MINUTE), minNowCalendar.get(Calendar.SECOND));