ViewPager2.PageTransformer

public interface ViewPager2.PageTransformer

Known direct subclasses
CompositePageTransformer

Allows for combining multiple PageTransformer objects.

MarginPageTransformer

Adds space between pages via the ViewPager2.PageTransformer API.


A PageTransformer is invoked whenever a visible/attached page is scrolled. This offers an opportunity for the application to apply a custom transformation to the page views using animation properties.

Summary

Public methods

abstract void
transformPage(@NonNull View page, float position)

Apply a property transformation to the given page.

Public methods

transformPage

Added in 1.0.0
abstract void transformPage(@NonNull View page, float position)

Apply a property transformation to the given page.

Parameters
@NonNull View page

Apply the transformation to this page

float position

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.