1

我想从 android studio 中的日历中选择一个、两个、三个或更多日期,我如何使用 Material Date Picker 或普通日期选择器来实现它并从日历中获取所有选定的日期

下面是我的材料日期选择器的代码


MaterialDatePicker.Builder builder = MaterialDatePicker.Builder.datePicker();

        builder.setTitleText("Select date range of publication");

        // If you want to set theme here
        //builder.setTheme(R.style.MaterialTheme);

        MaterialDatePicker<Long> materialDatePicker = builder.build();

        materialDatePicker.show(getParentFragmentManager(),"DATE_PICKER");

        materialDatePicker.addOnPositiveButtonClickListener(selection -> {

            etDatesToPublish.setText(materialDatePicker.getHeaderText());

        });

4

0 回答 0