I am making an attendance app i want to highlight multiple dates where student is absent and also make calendar view not clickable. only want to show calendar.
Asked
Active
Viewed 5,986 times
1 Answers
2
This question doesn't look, you have done any research.
However, you can use https://github.com/Applandeo/Material-Calendar-View
Pros:
Easily customizable. [I have used in 3-4 projects so far]
Fits in requirement like range picker, one-day selection (event based)
- Lightweight library, few files/ less code. You can also strip off the unnecessary code of range picker and other if you want. As for me, the requirement was only One-day-picker
i want to highlight multiple dates where student is absent
You can create a list of object of EventDay
which take the Calendar
instance. You can pass it to the CalendarView
. It will show the different event aka absentees in your case.
make calendar view not clickable
That's not the big deal, You can easily do that as CalendarView
is a custom view itself.
This is my latest screenshot from one of my project. It work really well.

Shubham AgaRwal
- 4,355
- 8
- 41
- 62
-
this showing some errors. first error of calenderview.setEvents(); // setEvents not found 2nd error in EventDay.java DateUtils.setMidnight(day) // setMidnight is not found – Bali G Jul 28 '18 at 08:15
-
i added EventDay.java from https://github.com/Applandeo/Material-Calendar-View/blob/master/library/src/main/java/com/applandeo/materialcalendarview/EventDay.java – Bali G Jul 28 '18 at 08:18
-
1This is not the scope of this problem. Every library has some learning curve. Give some time. Understand what is going on in this library. Eventually, You will be able to get the desired result. – Shubham AgaRwal Jul 28 '18 at 08:21
-
For each event it is creating new calendar object. how i can pass multiple dates to single calendar objects Calendar calendar1 = Calendar.getInstance(); calendar1.add(Calendar.DAY_OF_MONTH, 2); events.add(new EventDay(calendar1, R.drawable.lock)); Calendar calendar2 = Calendar.getInstance(); calendar2.add(Calendar.DAY_OF_MONTH, 5); events.add(new EventDay(calendar2, R.drawable.lock)); calendarView.setEvents(events); – Bali G Jul 29 '18 at 13:23
-
You need to pass a new instance of calendar for each event AFAIK – Shubham AgaRwal Jul 29 '18 at 13:55
-
@ShikharJaiswal You can customize this library as per your need. Since it is an old answer. I am not sure how exactly you can disable manual selection of dates. But I am sure you can add your logic of what date you want to make selected. or refer to https://github.com/Applandeo/Material-Calendar-View/issues/126 and other similar threads related to same. – Shubham AgaRwal May 20 '19 at 07:54
-
@Killer Is the library really customizable? Like for example, for adding events to the calenderview there is class named Eventday.java, which takes calender object and a drawable object as parameters to initialize. I wish it could have take a string value too so that i can also store a short descrption of the event. But when i try to edit the EventDay.java file of the library, it shows as readonly... – Shikhar May 20 '19 at 11:29
-
You can import in your project as a library and customize to as per your requirement. It might not be that flexible but you can customize it. – Shubham AgaRwal May 20 '19 at 11:33
-
@Killer..can you please elaborate...I have already imported in my project via build.gradle – Shikhar May 20 '19 at 11:34