Easy to use Horizontal Calendar View without dealing with messy RecyclerView.
- Set Start Date
- Set Multiple Special Dates
- Set normalDate, selectedDate, specialDate backgrounds.
- Set normalDate, selectedDate, specialDate day & date text colors
- show/hide title
- listen to date & month change events
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.Abhay-cloud:Horizontal-Infinite-Scrollable-Calendar-View-Android:v1.0.2'
}
<dev.abhaycloud.infinitescrollablecalendarview.InfiniteScrollableCalendarView
android:id="@+id/infiniteScrollableCalendarView"
app:startDate="2023-01-01"
app:showTitle="false"
app:normalDateBackground="@drawable/normal_date_2_bg"
app:specialDateBackground="@drawable/special_date_bg"
app:selectedDateBackground="@drawable/selected_date_2_bg"
app:normalDateTextColor="@color/white"
app:normalDayTextColor="@color/white"
app:selectedDateTextColor="@color/white"
app:selectedDayTextColor="@color/white"
app:specialDateTextColor="@color/white"
app:specialDayTextColor="@color/white"
/>
*Note: You must specify normalDateBackground, specialDateBackground & selectedDateBackground while you set up InfiniteScrollableCalendarView.
- Initialize InfiniteScrollableCalendarView
val infiniteCalendarView = findViewById(R.id.infiniteScrollableCalendarView)
- showTitle(Boolean)
infiniteCalendarView.showTitle(true) // by default value is true
- setStartDate(String)
// Date format must be in the form of YYYY-MM-DD
// ex: 1st Jan 2023 = 2023-01-01
infiniteCalendarView.setStartDate("2023-01-01")
- setSpecialDateList(list: ArrayList)
// Add dates to arrayList (type: SpecialDateModel)
val specialDateList = ArrayList<SpecialDateModel>()
specialDateModel.add(SpecialDateModel(LocalDate.parse("2023-01-10")))
specialDateModel.add(SpecialDateModel(LocalDate.parse("2023-01-21")))
infiniteCalendarView.setSpecialDateList(specialDateList)
infiniteCalendarView.setOnCalendarListener(object : CalendarCallBackListener{
override fun onDateChange(date: LocalDate) {
// do something
}
override fun onMonthChange(month: MonthModel) {
// do something
// binding.textView.text = "${month.monthName} ${month.year}"
}
})
Project is published under the Apache 2.0 license. Feel free to clone and modify repository as you want, but don't forget to add reference to authors.
If you have any difficulty then just message me on Instagram or LinkedIn.