The Android Developer Challenge is back! Submit your idea before December 2.

CompositePageTransformer

public final class CompositePageTransformer
extends Object implements ViewPager2.PageTransformer

java.lang.Object
   ↳ androidx.viewpager2.widget.CompositePageTransformer


Allows for combining multiple ViewPager2.PageTransformer objects.

Summary

Public constructors

CompositePageTransformer()

Public methods

void addTransformer(ViewPager2.PageTransformer transformer)

Adds a page transformer to the list.

void removeTransformer(ViewPager2.PageTransformer transformer)

Removes a page transformer from the list.

void transformPage(View page, float position)

Apply a property transformation to the given page.

Inherited methods

Public constructors

CompositePageTransformer

public CompositePageTransformer ()

Public methods

addTransformer

public void addTransformer (ViewPager2.PageTransformer transformer)

Adds a page transformer to the list.

Transformers will be executed in the order that they were added.

Parameters
transformer ViewPager2.PageTransformer

removeTransformer

public void removeTransformer (ViewPager2.PageTransformer transformer)

Removes a page transformer from the list.

Parameters
transformer ViewPager2.PageTransformer

transformPage

public void transformPage (View page, 
                float position)

Apply a property transformation to the given page.

Parameters
page View: Apply the transformation to this page

position float: Position of page relative to the current front-and-center position of the pager. 0 is front and center. 1 is one full page position to the right, and -2 is two pages to the left. Minimum / maximum observed values depend on how many pages we keep attached, which depends on offscreenPageLimit.