A Material design back port of Android's CalendarView. The goal is to have a Material lookand feel, rather than 100% parity with the platform's implementation.
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}'
}
MaterialCalendarView
into your layouts or view hierarchy.OnDateSelectedListener
or call MaterialCalendarView.getSelectedDates()
when you need it.Example:
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
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"
/>
Make sure to check all the documentation available here.
One of the aims of this library is to be customizable. The many options include:
All of this and more can be done via the decorator api. Please check out the decorator documentation.
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()
.
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.
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.
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.
Would you like to contribute? Fork us and send a pull request! Be sure to checkout our issues first.
Material Calendar View is Copyright (c) 2018 Prolific Interactive. It may be redistributed under the terms specified in the LICENSE file.
Material Calendar View is maintained and funded by Prolific Interactive. The names and logos are trademarks of Prolific Interactive.
implementation 'com.prolificinteractive:material-calendarview:1.4.2' package com.wlh.calendarview; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import
完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/CalendarView.html CalendarView public class CalendarView extends FrameLayout java.lang.Object ↳ android.view.View ↳ android.view.
1.设置选择的背景色 mCalendarView.setSelectionColor(Color.parseColor("#dd5050")); 2.修改选中背景颜色的大小(这里是减少10dip) DayView中 private void calculateBounds(int width, int height) { final int radius = Math.min(heigh
Material Design for AngularJS Apps Material Design is a specification for aunified system of visual, motion, and interaction design that adapts across different devices. Ourgoal is to deliver a lean,
材料拥有确定不变的特性和固定的行为。了解这些特性将有助于你在一定程度上熟悉材料,这与 Material Design 的构想是一致的。 物理特性 材料具有变化的长宽尺寸(以 dp 为计)和均匀的厚度(1dp)。 (上图)可取 材料的高度和宽度是可变的。 (上图)不可取 材料总是 1dp 厚。 材料会形成阴影。 阴影是由于材料元件之间的相对高度(Z 轴位置)而自然产生的。 (上图)可取 阴影描述材料
Material ScrollTop 是轻量级的回到页面顶部按钮,特点: 轻量级 Material Design inspired 涟漪效应 平滑的动态效果 定制化 一些实用的选项 CSS3 (Sass) + jQuery
Vue Material 是一个实现 Google 的像素材料设计的 Vue 组件库,它提供了适合所有现代Web浏览器的内置动态主题的组件,它的 API 也简单明了。 安装和使用: 通过 npm or yarn 安装 npm install vue-material@beta --saveyarn add vue-material@beta 像 JSPM and Bower 暂时还不支持 在代码中
Material-Animations 是一个很好过渡动画库, 可以应用于 Activity 与 Activity 之间的跳转, Fragment 与 Fragment 之间的跳转, 以及各个 View 变化前后的过渡动画。 效果图: