0

For one reason or another, I had to create a custom calendar component with custom views for days - different views for different types of dates - normal, events, etc - loading year configuration from JSON, etc.

  1. I've created it by extending the GridView with an adapter.
  2. I've created JSON-configuration loading etc.
  3. I've used grid touch events to make changing of current month easy.

But I need to do this "sliding" left and right animated - as it is in the android calendar application.

for example. I've read a lot on the web, but I still cannot find any tips on how to do this with GridView.

Maybe it was not the best idea to use GridView as a base class. Any help would be appreciated.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Ivan Peshev
  • 435
  • 7
  • 16

1 Answers1

0

I've used the following variant:

  • ViewPager which has 3 pages (0, 1, 2) loaded.
  • On each page I have a GridView representing a month from the calendar.

On page 0 is the previous month On page 1 is the current month On page 2 is the next month

In ViewPager adapter I used adapters for the 3 Gridviews.

Initially I set active page to 1.

On each page change I recalculate the month data for previous, current and next month and set active page again to 1.

This way I simulate something like "infinite" view pager. For the moment it's ok for my task - sliding pages calendar.

Ivan Peshev
  • 435
  • 7
  • 16