{"id":13643541,"url":"https://github.com/wenzhihao123/Android-CalendarView-master","last_synced_at":"2025-04-21T02:30:34.290Z","repository":{"id":217102542,"uuid":"88385745","full_name":"wenzhihao123/Android-CalendarView-master","owner":"wenzhihao123","description":"Android开发实现自定义日历、日期选择控件","archived":false,"fork":false,"pushed_at":"2017-04-16T02:28:19.000Z","size":553,"stargazers_count":98,"open_issues_count":0,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T15:42:52.471Z","etag":null,"topics":["android-calendarview-master","calendar","gridview"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wenzhihao123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-04-16T02:17:48.000Z","updated_at":"2024-07-10T00:42:03.000Z","dependencies_parsed_at":"2024-01-14T16:12:23.176Z","dependency_job_id":null,"html_url":"https://github.com/wenzhihao123/Android-CalendarView-master","commit_stats":null,"previous_names":["wenzhihao123/android-calendarview-master"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenzhihao123%2FAndroid-CalendarView-master","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenzhihao123%2FAndroid-CalendarView-master/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenzhihao123%2FAndroid-CalendarView-master/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenzhihao123%2FAndroid-CalendarView-master/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wenzhihao123","download_url":"https://codeload.github.com/wenzhihao123/Android-CalendarView-master/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249986022,"owners_count":21356310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-calendarview-master","calendar","gridview"],"created_at":"2024-08-02T01:01:49.027Z","updated_at":"2025-04-21T02:30:33.733Z","avatar_url":"https://github.com/wenzhihao123.png","language":"Java","funding_links":[],"categories":["日历时间"],"sub_categories":[],"readme":"# Android-CalendarView-master\nAndroid开发实现自定义日历、日期选择控件\n最近项目需要日历效果，考虑用第三方的反而不太适合设计需求，修改复杂，与其这样不入自己重新写一个干净的控件。虽不是什么牛逼控件，但是也需要我们能按照设计自己写出来。在此记录一下实现思路。\n\n效果图：\n\n![切换周](http://upload-images.jianshu.io/upload_images/2018489-4717cf33106e3544.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\n\n![切换月份](http://upload-images.jianshu.io/upload_images/2018489-eba2c986665394ac.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\n\n#### 实现思路\n* 头部是一个自定义组合控件；\n* 显示一周的日期部分用GridView 更加方便更新；\n* 切换月的部分是一个自定义PopupWindow；\n* GridView选中效果；\n* GridView根据手势GestureDetector监听左右滑动；\n* 核心其实还是Calendar类，根据这个类我们可以获取制定日期一周的日期集合、可以获取制定日期一月的日期集合等等；\n* 根据阳历日期获取阴历日期\n\n#### 使用\n```\n// xml布局引用\n\u003ccom.wzh.calendar.view.DataView\n        android:id=\"@+id/week\"\n        android:layout_width=\"match_parent\"\n        android:background=\"@color/color_ffffff\"\n        android:layout_height=\"wrap_content\"\u003e\n\u003c/com.wzh.calendar.view.DataView\u003e\n\n// 代码中，自定义回调监听选中的日期\ndataView = (DataView) findViewById(R.id.week);\ndataView.setOnSelectListener(new DataView.OnSelectListener() {\n            @Override\n            public void onSelected(DateEntity date) {\n                info.setText(\"日期：\"+ date.date+\"\\n\"+\n                             \"周几：\"+ date.weekName+\"\\n\"+\n                             \"今日：\"+ date.isToday+\"\\n\"+\n                             \"时间戳：\"+ date.million+\"\\n\");\n                Log.e(\"wenzhiao--------------\",date.toString());\n            }\n });\n//需要传递此种格式的日期，不传默认是获取今日的日期\ndataView.getData(\"2017-04-19\");\n```\n[博客详解地址](http://www.jianshu.com/p/a2f102c728ce)\n\n邮箱：821027320@qq.com\n\nQQ:821027320","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwenzhihao123%2FAndroid-CalendarView-master","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwenzhihao123%2FAndroid-CalendarView-master","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwenzhihao123%2FAndroid-CalendarView-master/lists"}