Dialogplus:在DatePicker中切换月份和年份无效

问题描述 投票:0回答:1

我有DatePicker作为日历视图,它放置在DialogPlus布局中。因此,问题在于选择器无法通过单击箭头(向左/向右)切换月份,并且年份选择也不起作用。有什么想法吗?

Issue on Github

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

方法:

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();

}
android android-datepicker dialogplus
1个回答
0
投票

您可以使用此库点击here届时,您可以使用MonthDayPicker

 new DialogPlusBuilder().blurBackground()
                .buildMonthDayPickerDialog(Calendar.getInstance(),
                        (pickedMonth, pickedDay) ->{ //TODO impelement your bussiness}
                .show(getSupportFragmentManager(), "Month Day Picker");
© www.soinside.com 2019 - 2024. All rights reserved.