An android library which provides a compact calendar view much like the one used in google calenders.

Min SDK   16
Latest Commit   2017-09-10 21:14:32
License   unknown









CountdownView Android Countdown View
MaterialDateTimePicker Pick a date or time on Android in style
TimeRangePicker Android time range picker

CompactCalendarView Build Status

CompactCalendarView is a simple calendar view which provides scrolling between months. It's based on Java's Date and Calendar classes. It provides a simple api to query for dates and listeners for specific events. For example, when the calendar has scrolled to a new month or a day has been selected. Still under active development.


Please raise an issue of the requirement so that a discussion can take before any code is written, even if you intend to raise a pull request. Please see setup for testing.


CompactCalendarView makes use of screenshot-tests-for-android ( This is for UI testing. Since screenshot-tests-for-android takes screenshots, we need a way to ensure images can be reproduced consistently. To do this, a specific emulator is used to run tests. Unfortunately, an older emulator is used for now. New pull requests which change functionality some how should aim to create new screenshot tests or unit tests if possible. To run this locally, run the below commands:

Pre-requisite (Also refer to .travis.yml):

  • Python
  • Python pillow installed
  • Install android-19 (can be done through android sdk manager or command line).

Android 19 emulator is used because it seems to be a fast enough on travis-ci and because x86 emulators are not supported on travis-ci. Newer android version is possible but build times will increase.

Install the abi and accept:

$ android update sdk --no-ui --all --filter sys-img-armeabi-v7a-android-19

Create the emulator:

$ echo no | android create avd --force -n testCompactCalendarEmulator -t android-19 --abi armeabi-v7a

Create sd card (creating in current dir): Any problems with sdcard are best solved by deleting and trying again

$ mksdcard -l sdcard 100M sdcard

Run emulator (with out audio and window):

$ emulator -avd testCompactCalendarEmulator -no-audio -no-window -sdcard sdcard &

Run emulator and watch(with audio and window):

$ emulator -avd testCompactCalendarEmulator -sdcard sdcard 

Running the tests to verify that the current tests pass and to check which tests are not producing the same screenshot:

$ ./gradlew verifyMode screenshotTests 

To generate new screenshots if new tests have been added:

$ ./gradlew recordMode screenshotTests 

Run the unit tests like below:

$ ./gradlew test

Android studio emulator

It's possible to test using android studio emulator. However, it must be android 19 and and 480x800 screen resolution. One example is the Nexus S emulator. Just start the emulator and execute the gradle commands to run the tests. Emulator should be found automatically.

Open/Close animations

The library supports opening/closing with or without animations.


Example usage

It is possible to change the appearance of the view via a few properties. This includes the background color, text color, textsize color of the current day and the color of the first day of the month.


Please see Sample app for full example.

    // ... code omitted for brevity         
    protected void onCreate(Bundle savedInstanceState) {
        final CompactCalendarView compactCalendarView = (CompactCalendarView) findViewById(;
        // Set first day of week to Monday, defaults to Monday so calling setFirstDayOfWeek is not necessary
        // Use constants provided by Java Calendar class
        // Add event 1 on Sun, 07 Jun 2015 18:20:51 GMT
        Event ev1 = new Event(Color.GREEN, 1433701251000L, "Some extra data that I want to store.");

        // Added event 2 GMT: Sun, 07 Jun 2015 19:10:51 GMT
        Event ev2 =