Konstantin Konopko
Konstantin Konopko

Reputation: 5418

Dialogplus: switching a month and year in DatePicker not working

I have DatePicker as calendar view, it places in DialogPlus layout. So the problem is the picker can't switch month by clicking arrows (to left/rigth) and year selection also doesn't work. Any ideas?

Issue on Github

<DatePicker
    android:id="@+id/pickerDate"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:datePickerMode="calendar"/>

Method:

private void openDialogDatePickup() {
    PickerDateBinding binding = PickerDateBinding.inflate(getLayoutInflater());
    datePicker = binding.pickerDate;
    // set datePicker options
    dialog = DialogPlus.newDialog(this)
            .setContentHolder(new ViewHolder(binding.getRoot()))
            .setExpanded(false)
            .setCancelable(true)
            .create();
    dialog.show();

}

Upvotes: 1

Views: 78

Answers (1)

Fawzy
Fawzy

Reputation: 51

You can add this library Click here and then you can use MonthDayPicker

 new DialogPlusBuilder().blurBackground()
                .buildMonthDayPickerDialog(Calendar.getInstance(),
                        (pickedMonth, pickedDay) ->{ //TODO implement your business}
                .show(getSupportFragmentManager(), "Month Day Picker");

Upvotes: 2

Related Questions