Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Pixplicity/MultiViewPager

The MultiViewPager is an extension of the support-v4 library's ViewPager that allows the pages to be wider or narrower than the ViewPager itself. It takes care of aligning the pages next to each other, and always keeping the selected page centered.
https://github.com/Pixplicity/MultiViewPager

Last synced: about 1 month ago
JSON representation

The MultiViewPager is an extension of the support-v4 library's ViewPager that allows the pages to be wider or narrower than the ViewPager itself. It takes care of aligning the pages next to each other, and always keeping the selected page centered.

Awesome Lists containing this project

README

        

MultiViewPager
==============
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-MultiViewPager-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1489)
[![Build Status](https://travis-ci.org/Pixplicity/MultiViewPager.svg?branch=master)](https://travis-ci.org/Pixplicity/MultiViewPager)

*UPDATE:* This behavior is now included in the RecyclerView for support lib 24.2.0 and later. Please look at using [LinearSnapHelper](https://developer.android.com/reference/android/support/v7/widget/LinearSnapHelper.html).

The MultiViewPager is an extension of the support-v4 library's ViewPager that allows the pages to be wider or narrower than the ViewPager itself. It takes care of aligning the pages next to each other, and always keeping the selected page centered.

![Sample app](http://i.imgur.com/0yGMSyE.gif)

## Sample

Simply add the MultiViewPager into your layout:

Be sure to declare the `app` namespace:
`xmlns:app="http://schemas.android.com/apk/res-auto"`

Take note of the custom attribute `matchChildWidth`. This attribute should match an ID in the ViewPager's first child view. In the sample project, the layout of the pages is:









The child view with ID `@id/vg_cover` will determine the width of the page. In this example, the width would be 200dp. In order to get this hooked up, we provide MultiViewPager with the reference to the child, `@id/vg_cover`:

In this way, it knows to size the pages according to the dimension of that View or ViewGroup.

## Download

Download the latest [AAR](http://search.maven.org/#search|ga|1|g:"com.pixplicity.multiviewpager") or grab via Maven:
```XML

com.pixplicity.multiviewpager
library
1.0
aar

```

or Gradle:
```Java
compile 'com.pixplicity.multiviewpager:library:1.0'
```

## License

Licensed under the Apache license.