Material-Calendar-View
Material-Calendar-View is a simple and customizable calendar widget for Android based on Material Design. The widget has two funcionalities: a date picker to select dates (available as an XML widget and a dialog) and a classic calendar. The date picker can work either as a single day picker, many days picker or range picker.
Features
- Material Design
- Single date picker
- Many dates picker
- Range picker
- Events icons
- Fully colors customization
How to migrate from previous version to 1.4.0?
We have renamed setOnPreviousButtonClickListener() and setOnForwardButtonClickListener() so please refer to Previous and forward buttons listeners.
How to use?
Make sure you are using the newest com.android.support:appcompat-v7.
Make sure you have defined the jcenter() repository in project's build.gradle file:
allprojects {
repositories {
jcenter()
}
}
Add the dependency to module's build.gradle file:
dependencies {
compile 'com.applandeo:material-calendar-view:1.4.0'
}
To your XML layout file add:
Adding events with icons:
Clicks handling:
Getting a selected days in the picker mode:
If you want to get all selected days, especially if you use multi date or range picker you should use the following code:
...or if you want to get the first selected day, for example in case of using single date picker, you can use:
Setting a current date:
Setting minumum and maximum dates:
Setting disabled dates:
Previous and forward page change listeners:
Customization
If you want to use calendar in the picker mode, you have to use the following tags:
app:type="one_day_picker"
app:type="many_days_picker"
app:type="range_picker"
Colors customization:
- Header color:
app:headerColor="[color]"
- Header label color:
app:headerLabelColor="[color]"
- Previous button image resource:
app:previousButtonSrc="[drawable]"
- Forward button image resource:
app:forwardButtonSrc="[drawable]"
- Abbreviations bar color:
app:abbreviationsBarColor="[color]"
- Abbreviations labels color:
app:abbreviationsLabelsColor="[color]"
- Calendar pages color:
app:pagesColor="[color]"
- Selection color in picker mode:
app:selectionColor="[color]"
- Selection label color in picker mode:
app:selectionLabelColor="[color]"
- Days labels color:
app:daysLabelsColor="[color]"
- Color of visible days labels from previous and next month page:
app:anotherMonthsDaysLabelsColor="[color]"
- Disabled days labels color:
app:disabledDaysLabelsColor="[color]"
- Today label color:
app:todayLabelColor="[color]"
Translations:
To translate months names, abbreviations of days, "TODAY", "OK" and "CANCEL" buttons, just add below tags to your strings.xml
file:
Date Picker Dialog
To use another picker type replace CalendarView.ONE_DAY_PICKER
with CalendarView.MANY_DAYS_PICKER
or CalendarView.RANGE_PICKER
.