A Material design back port of Android's CalendarView migrated to Androidx libraries. The goal is to have a Material look and 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.thiago-you:material-calendarview:1.1.0'
}
- Add
MaterialCalendarView
into your layouts or view hierarchy. - Set a
OnDateSelectedListener
or callMaterialCalendarView.getSelectedDates()
when you need it.
Example:
<you.thiago.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:
- Define the view's width and height in terms of tile size
- Single or Multiple date selection, or disabling selection entirely
- Showing dates from other months or those out of range
- Setting the first day of the week
- Show only a range of dates
- Customize the top bar
- Custom labels for the header, weekdays, or individual days
All of this and more can be done via the decorator api. Please check out the decorator documentation.
Would you like to contribute? Fork us and send a pull request! Be sure to checkout our issues first.