DatePickerDialog and TimePickerDialog are blank

时间:2016-08-31 18:35:40

标签: android android-datepicker android-timepicker

My time/date pickers have stopped working as intended. I have looked around but couldn't find anything. The picker windows do not show the selected time as well as blanks out which days are selected.

Could this be a theme/style issue even though I did not modify either one?

I am running on 6.0.1.

Here are some images for reference: timepickerdatepicker

Here are the Dialog initializations:

public void showTimeDialog(final TextView timeTextview, Calendar calendar){
    int hour = calendar.get(Calendar.HOUR_OF_DAY);
    int minute = calendar.get(Calendar.MINUTE);

    // Launch time picker dialog
    TimePickerDialog mTimePicker = new TimePickerDialog(getActivity(), new TimePickerDialog.OnTimeSetListener() {
        @Override
        public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
            timeTextview.setText(Util.Convert24To12Hour(selectedHour, selectedMinute));
            System.out.println(selectedHour + ":" + selectedMinute);
        }
    }, hour, minute, false); //last parameter = 24 hour time
    mTimePicker.setTitle("Select Time");
    mTimePicker.setCanceledOnTouchOutside(true);
    mTimePicker.show();
}


public void showDateDialog(final TextView dateTextview, Calendar calendar){
    // Get current date
    int mYear = calendar.get(Calendar.YEAR);
    int mMonth = calendar.get(Calendar.MONTH);
    int mDay = calendar.get(Calendar.DAY_OF_MONTH);

   // Launch date picker dialog
    DatePickerDialog dpd = new DatePickerDialog(context,
        new DatePickerDialog.OnDateSetListener() {

            @Override
            public void onDateSet(DatePicker view, int year,
                                  int monthOfYear, int dayOfMonth) {
                // Display selected date in textbox
                dateTextview.setText(Util.ConvertToDisplayableDate(year, monthOfYear, dayOfMonth));
            }
        }, mYear, mMonth, mDay);
    dpd.setTitle("Select Date");
    dpd.setCanceledOnTouchOutside(true);
    dpd.show();
}

1 个答案:

答案 0 :(得分:2)

我认为主题中的颜色或文字颜色或背景颜色是白色的,就像文字颜色和背景颜色相同意味着没有可见性可以改变主题中的颜色吗?