1

Basically, I'm trying to create a 3 day calendar view. My example is working so far as shown in the screenshot. The pages 'snap' as well. screenshot on ViewPager with multiple views

In order to achieve multiple pages visible at the same time I used the following:

<android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:paddingTop="5dp"
        android:paddingLeft="8dp"
        **android:paddingRight="200dp"**
        android:clipToPadding="false"
        android:paddingBottom="5dp"
        android:background="@android:color/darker_gray"/>

The padding is set to 200dp. Is this a very hacky method? It also leaves 200dp empty space on the far right at the end of the list. (Obviously I would handle the padding in java code to make calculations such as a third of the screen)

Also am I implementing my calendar the right way?

ovg
  • 1,056
  • 1
  • 11
  • 25
  • [CommonsBlog - Multiple-View ViewPager Options](https://commonsware.com/blog/2012/08/20/multiple-view-viewpager-options.html) (a lil dated, but still great reading) – petey Mar 09 '16 at 21:43

1 Answers1

0

@petey recommended from a great source:

The key, of course, is to override getPageWidth() in your PagerAdapter:

@Override public float getPageWidth(int position) { return(0.5f); }

ovg
  • 1,056
  • 1
  • 11
  • 25