-
Notifications
You must be signed in to change notification settings - Fork 315
日历设置标记、替换文字
yannecer edited this page Apr 3, 2020
·
1 revision
日历设置标记、替换文字只针对项目内部的InnerPainter,如果使用了自定义CalendarPainter,则设置无效,需要自己实现相关功能, 绘制的内容统一交由CalendarPainter处理,可以实现各种不同的标记等,绘制,一切皆有可能
此功能为默认 CalendarPainter 类 InnerPainter 的功能,如果设置了自定义 CalendarPainter ,没有此方法,需要自己实现
List<String> pointList = Arrays.asList("2018-10-01", "2018-11-19", "2018-11-20", "2018-05-23", "2019-01-01");
InnerPainter innerPainter = (InnerPainter) miui10Calendar.getCalendarPainter();
innerPainter.setPointList(pointList);
此功能为默认 CalendarPainter 类 InnerPainter 的功能,如果设置了自定义 CalendarPainter ,没有此方法,需要自己实现
List<String> holidayList = Arrays.asList("2018-10-01", "2018-11-19", "2018-11-20");
List<String> holidayList = Arrays.asList("2019-10-01", "2019-11-19", "2019-11-20");
InnerPainter innerPainter = (InnerPainter) miui10Calendar.getCalendarPainter();
innerPainter.setLegalHolidayList(holidayList,workdayList);
此功能为默认 CalendarPainter 类 InnerPainter 的功能,如果设置了自定义 CalendarPainter ,没有此方法,需要自己实现
InnerPainter innerPainter = (InnerPainter) miui10Calendar.getCalendarPainter();
Map<String, String> strMap = new HashMap<>();
strMap.put("2019-01-25", "测试");
strMap.put("2019-01-23", "测试1");
strMap.put("2019-01-24", "测试2");
innerPainter.setReplaceLunarStrMap(strMap);
Map<String, Integer> colorMap = new HashMap<>();
colorMap.put("2019-01-25", Color.RED);
colorMap.put("2019-01-23", Color.GREEN);
colorMap.put("2019-01-24", Color.parseColor("#000000"));
innerPainter.setReplaceLunarColorMap(colorMap);
日历支持拉伸之后显示一行文字
此功能为默认 CalendarPainter 类 InnerPainter 的功能,如果设置了自定义 CalendarPainter ,没有此方法,需要自己实现
InnerPainter innerPainter = (InnerPainter) miui10Calendar.getCalendarPainter();
innerPainter.setPointList(pointList);
Map<String, String> strMap = new HashMap<>();
strMap.put("2019-07-01", "测试");
strMap.put("2019-07-19", "测试1");
strMap.put("2019-07-25", "测试2");
innerPainter.setStretchStrMap(strMap);