javaandroid-studiocalendarandroid-calendarcalendarview

Android Studio CalendarView mark dates


I am doing an app and I want to add a calendarView. I just want to mark some specific dates using the day, month and year. I founded MCalendarView library but I dont like the design.

Someone knows how to mark dates in regular CalendarView or improve the design of MCalendarView?

Thanks for your time.


Solution

  • I know this is an old topic and you have probably solved your problem since, but it might help other people. I found this library to mark different dates and even more with a design very similar to the default Android CalendarView. Hope this could help https://github.com/prolificinteractive/material-calendarview

    installation

    Add the JitPack repository to your build file

    allprojects {
      repositories {
        ...
        maven { url 'https://jitpack.io' }
      }
    }
    

    Add the dependency (do not forget to change the ${version} with a valide version, just look for the library to https://jitpack.io and choose one)

    dependencies {
      implementation 'com.github.prolificinteractive:material-calendarview:${version}'
    }
    

    Now just call the view in you layout

    <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"
        />
    

    Documentation on how to use the api to customize the view is available here