1

我正在尝试实现日期选择器,但出现以下 lint 错误


Raw use of parameterized class 'MaterialDatePicker.Builder'

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


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

1 回答 1

3

该类需要一个您没有提供给它的参数,因此您正试图原始使用它。

如下

MaterialDatePicker.Builder<Long> builder = MaterialDatePicker.Builder.datePicker();
于 2021-06-16T06:15:30.853 回答