android - 我无法在 android 的材质日历中添加更多图标
问题描述
我正在研究android材料日历我正在制作一个怀孕日历,如果我将在接下来的几天点击一天选择,那么在里面添加自动图标是我的代码:
calendarView.setOnDayClickListener(new OnDayClickListener() {
@Override
public void onDayClick(EventDay eventDay) {
Calendar clickedDayCalendar = eventDay.getCalendar();
/* clickedDayCalendar.set( clickedDayCalendar.get(Calendar.DAY_OF_MONTH + 4) , clickedDayCalendar.get(Calendar.MONTH) , clickedDayCalendar.get(Calendar.YEAR));*/
events.add(new EventDay(clickedDayCalendar, R.drawable.sample_icon_2));
ArrayList<String> eventDays = new ArrayList<String>();
calendarView.setEvents(events);
/* alert_diaog_picker(eventDay.getCalendar().getTime().toString());*/
// Calendar clickedDayCalendar = eventDay.getCalendar();
/* Toast.makeText(getContext(), "Selected Date:\n" + "Day = " + clickedDayCalendar.get(Calendar.DAY_OF_MONTH) +
"\n" + "Month = " + clickedDayCalendar.get(Calendar.MONTH) + "\n" + "Year = " + clickedDayCalendar.get(Calendar.YEAR), Toast.LENGTH_LONG).show();*/
}
});
return view;
}
这是我的xml代码:
<com.applandeo.materialcalendarview.CalendarView
android:id="@+id/calendarView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:abbreviationsBarColor="#303F9F"
app:abbreviationsLabelsColor="@android:color/white"
app:daysLabelsColor="@android:color/white"
app:headerColor="#1A237E"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:pagesColor="#3F51B5"
app:eventsEnabled="false"
app:selectionColor="@android:color/white"
app:selectionLabelColor="#3F51B5"
app:anotherMonthsDaysLabelsColor="#3F51B5"
app:todayLabelColor="#AEEA00"
app:type="many_days_picker" />
<Button
android:id="@+id/getDateButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Get date"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/calendarView" />
implementation 'com.applandeo:material-calendar-view:1.6.0'
现在它就像我单击日期时一样工作,它仅包含该日期的图标,但我想在接下来的四天再添加一个图标,请帮助我提前谢谢我感谢每一个答案
解决方案
推荐阅读
- typescript - 如何在我的声明文件中从库中导入和引用类型
- r - 尽管“na.action”设置为“na.roughfix”,但缺少值错误
- php - Laravel - 找不到列:'full_name'
- namespaces - Sphinx 是改名为 Sphinx-doc,还是只是 Sphinx?
- python - 我需要将列表元素保存在单独的列表中
- typescript - Forge Viewer 的 TypeScript 定义缺少与配置文件相关的类型
- android - 如何在 kotlin 中创建一个简单的 firebase 搜索查询
- javascript - Webpack:使用父目录中的数据而不复制
- javascript - React 测试库:无法更改 Material UI DatePicker 输入值
- fluent-bit - Fluentbit rewrite_tag 不适用于 JSON 数组