android material design 日历,Material Calendar View:一款Material Design风格的日历控件

e9ccbcacf934e2e9a201669b28590de0.png

Material Calendar View

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f416e64726f6964253230417273656e616c2d4d6174657269616c25323043616c656e646172253230566965772d626c75652e7376673f7374796c653d666c617468747470733a2f2f6a69747061636b2e696f2f762f70726f6c69666963696e7465726163746976652f6d6174657269616c2d63616c656e646172766965772e73766768747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70726f6c69666963696e7465726163746976652f6d6174657269616c2d63616c656e646172766965772e7376673f6d61784167653d32353932303030

A Material design back port of Android's CalendarView. The goal is to have a Material look and feel, rather than 100% parity with the platform's implementation.

screencast.gif

Installation

Step 1. Add the JitPack repository to your build file

allprojects {

repositories {

...

maven { url 'https://jitpack.io' }

}

}

Step 2. Add the dependency

dependencies {

implementation 'com.github.prolificinteractive:material-calendarview:${version}'

}

Usage

Add MaterialCalendarView into your layouts or view hierarchy.

Set a OnDateSelectedListener or call MaterialCalendarView.getSelectedDates() when you need it.

Example:

xmlns:app="http://schemas.android.com/apk/res-auto"

android:id="@+id/calendarView"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:mcv_showOtherDates="all"

app:mcv_selectionColor="#00F"

/>

Documentation

Make sure to check all the documentation available here.

Customization

One of the aims of this library is to be customizable. The many options include:

Events, Highlighting, Custom Selectors, and More!

All of this and more can be done via the decorator api. Please check out the decorator documentation.

Recent Changes

Major Change in 2.0

Material CalendarView 2.0 comes in with a major change into the core of it's API, we transitioned from using java.util.Calendar to java.time.LocalDate. Also that should not impact the public api (we are still using CalendarDay), both Calendar and LocalDate function a little bit differently. One example of that: Months are now indexed from 1 (January) to 12 (December). You can access from the LocalDate from CalendarDay using getDate().

Major Change in 1.6.0

Also this release doesn't have any break changes, it provides significant improvements to the widget. More customization have been added for the user (custom fonts, long click listener, show/hide weekdays) as well as various fixes, improvements to the sample app, and general cleanup. Make sure to check the CHANGELOG and the release section for more details.

Major Change in 1.5.0

We recently updated to the latest gradle and decided to move over our libraries to the hosting service Jitpack. Please refer to the installation section for more details.

Major Change in 1.4.0

Breaking Change: setFirstDayOfWeek, setMin/MaxDate, and setCalendarDisplayMode are moved to a State object. This was necessary because it was unclear that these were not simple setters--individually, they were side effecting and triggered full adapter/date range recalculations. Typical usage of the view involves setting all these invariants up front during onCreate and it was unknown to the user that setting all 4 of these would create a lot of waste. Not to mention certain things were side effecting--some would reset the current day or selected date. As a result, the same 4 methods called in a different order could result in a different state, which is bad.

For most cases you will simply need to replace setting those invariants with:

mcv.state().edit()

.setFirstDayOfWeek(Calendar.WEDNESDAY)

.setMinimumDate(CalendarDay.from(2016, 4, 3))

.setMaximumDate(CalendarDay.from(2016, 5, 12))

.setCalendarDisplayMode(CalendarMode.WEEKS)

.commit();

mcv.state().edit() will retain previously set values; mcv.newState() will create a new state using default values. Calling commit will trigger the rebuild of adapters and date ranges. It is recommended these state changes occur as the first modification to MCV (before configuring anything else like current date or selected date); we make no guarantee those modifications will be retained when the state is modified.

See CUSTOMIZATION_BUILDER for usage details.

New: setSelectionMode(SELECTION_MODE_RANGE) was added to allow 2 dates to be selected and have the entire range of dates selected. Much thanks to papageorgiouk for his work on this feature.

See other changes in the CHANGELOG.

Contributing

Would you like to contribute? Fork us and send a pull request! Be sure to checkout our issues first.

License

Material Calendar View is Copyright (c) 2018 Prolific Interactive. It may be redistributed under the terms specified in the LICENSE file.

Maintainers

fcb659664399a80b2304cefdb93ec18e.png

Material Calendar View is maintained and funded by Prolific Interactive. The names and logos are trademarks of Prolific Interactive.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值