我正在尝试实现日期选择器,但我得到了以下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());
});
该类需要一个您没有提供给它的参数,因此您正尝试原始使用它。
如下
MaterialDatePicker.Builder<Long> builder = MaterialDatePicker.Builder.datePicker();