MaterialCalendarView使用时遇到的问题
一、概述
MaterialCalendarView是一个开源项目。功能强大支持多选、单选、标注等。
二、问题
1、其继承自ViewGroup,故与CalendarView半毛钱关系都没有,完全是一个新的类
2、其子类CalendarDay是经过调整的
CalendarDay date = new CalendarDay();
......
Log.e(LOG_TAG, "Date选中日期:" + date.getDate().getYear() + "-" + date.getDate().getMonth() + "-" + date.getDate().getDay());
Log.e(LOG_TAG, "Calendar选中日期:" + date.getCalendar().get(Calendar.YEAR) + "-" + (date.getCalendar().get(Calendar.MONTH) + 1) + "-" + date.getCalendar().get(Calendar.DAY_OF_MONTH));
得到的结果为
Date选中日期:116-3-6
Calendar选中日期:2016-4-30
即:
CalendarDay.getDate().getYear()得到的年份 = 真实年份 - 1900
CalendarDay.getDate().getMonth()得到的月份 = 真实年份 - 1
CalendarDay.getDate().getDay()得到的日 = 星期数 - 1
3、关于DayViewDecorator类
此类为抽象类,定义如下
/**
* Decorate Day views with drawables and text manipulation
*/
public interface DayViewDecorator {
/**
* Determine if a specific day should be decorated
*
* @param day {@linkplain CalendarDay} to possibly decorate
* @return true if this decorator should be applied to the provided day
*/
boolean shouldDecorate(CalendarDay day);
/**
* Set decoration options onto a facade to be applied to all relevant days
*
* @param view View to decorate
*/
void decorate(DayViewFacade view);
}
实际使用时,只需实现上述两个方法即可,例如
public class EventDecorator implements DayViewDecorator {
private final int color;
private final HashSet<CalendarDay> dates;
public EventDecorator(int color, Collection<CalendarDay> dates) {
this.color = color;
this.dates = new HashSet<>(dates);
}
@Override
public boolean shouldDecorate(CalendarDay day) {
return dates.contains(day);
}
@Override
public void decorate(DayViewFacade view) {
view.addSpan(new DotSpan(5, color));
}
}
MaterialCalendarView使用时遇到的问题的更多相关文章
- Cookie使用时需要注意个数及大小限制
各浏览器对Cookie有一定的限制,在使用时需要格外注意. 各浏览器之间对cookie的不同限制: IE6.0 IE7.0/8.0/9.0+ Opera FF Safari Chrome cook ...
- EntityFrameWork 使用时碰到的小问题
EntityFrameWork 使用时碰到的小问题 1,在使用orm访问数据库的相目里,也要引用EntityFrameWork.dll,否则无法使用orm 否则,编译错误 错误 5 "Sys ...
- MySQL 安装和启动服务,“本地计算机 上的 MySQL 服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。”
MySQL 安装和启动服务,以及遇到的问题 MySQL版本: mysql-5.7.13-winx64.zip (免安装,解压放到程序文件夹即可,比如 C:\Program Files\mysql-5. ...
- [备忘][转]rsync使用时的常见问题
sync使用时的常见问题: 错误1: rsync: read error: Connection reset by peer (104) rsync error: error in rsync pro ...
- 小白学数据分析----->移动游戏的使用时长分析
写下该文章,是因为之前看到了几款游戏一个典型的玩家刺激活动,在<多塔联盟>,<萌江湖>等多款游戏的设计中都有体现,如下图所示: 这个功能点的设计,今天在这里讲的更多的还是跟数据 ...
- VS2010 使用时选择代码或双击时出错,点击窗口按钮后VS自动重启问题
VS2010 使用时选择代码或双击时出错崩溃,点击窗口按钮后VS自动重启问题 下载补丁,打上补丁之后,重启电脑,解决了问题. WindowsXP的下载地址:Windows XP 更新程序 (KB971 ...
- [开发笔记]-sqlite数据库在使用时遇到的奇葩问题记录
有时候做些简单的项目一般都会选择sqlite数据库,优点有很多,这里就不详细说了. 在此主要记录一些平时在使用时遇到的问题及解决方法.希望能对大家有所帮助. --------------------- ...
- 本地计算机上的OracleOraDb11g_home1TNSListener服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。——Oracle监听器服务无法启动!
问题: oracle服务设置为手动启动.但是开机后手动启动监听服务后弹出框,提示“本地计算机上的OracleOraDb11g_home1TNSListener服务启动后停止.某些服务在未由其他服务或程 ...
- [习题]日历(Calendar)控件的障眼法(.Visible属性),使用时才出现?不用就消失?
原文出處 http://www.dotblogs.com.tw/mis2000lab/archive/2013/09/02/calendar_icon_visible.aspx [习题]日历(Cal ...
随机推荐
- myeclipse+tomcat 工程名改名的问题 ——————完美解决方案
当建好的工程再重命名之后,发布和访问的时候都还是原来的名字,这个问题纠结了我很久,最好找到解决方法,这里分享一下,希望大家不要再受这种困惑.解决方法: 点击工程右键->properties-&g ...
- Unity3d 提示 "The scripts file name does not match the name of the class defined in the script!"的解决办法
有两个原因,一个是文件的名称和类名不一致 第二个原因是有命名空间, 排除应该是可以修复的
- Ubuntu 安装OpenCV3.0.0
Ubuntu安装OpenCV3.0.0 为了看看opencv3.0的HDR效果,尝试安装opencv3.0到ubuntu12.04上面,安装了好几次终于成功了. 参考博客: http://www.sa ...
- 【转】html、css、js文件加载顺序及执行情况
原链接:http://www.cnblogs.com/Walker-lyl/p/5262075.html 今天看书,看到html,css,js加载执行情况,发现自己并不是真正的了解,网上搜了半小时依然 ...
- Android开发中Handler的经典总结
当应用程序启动时,Android首先会开启一个主线程(也就是UI线程),主线程为管理界面中的UI控件,进行事件分发. AD: 一.Handler的定义: 主要接受子线程发送的数据, 并用此数据配合主线 ...
- 快速幂 fast_exp
long long fast_exp(int base,long long exp,int mod) { long long ans=1LL,a=base; ) { if(exp&1LL) a ...
- linux命令缩写及全称
apt = Advanced Packaging Tool ar = archiver as = assembler awk = "Aho Weiberger and Kernighan&q ...
- Spring.Net Remoting 相关使用
http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Remoting.html 本博客系统转载 原文为 Spring.Se ...
- HttpHandler与HttpModule的用处与区别
问题1:什么是HttpHandler? 问题2:什么是HttpModule? 问题3:什么时候应该使用HttpHandler什么时候使用HttpModule? 答案1:HttpHandler,Http ...
- 【转】Docker 常用命令
转载: http://blog.csdn.net/zhang__jiayu/article/details/42611469 docker images:列出本地所有镜像 docker searc ...