setPageTransformer

open fun setPageTransformer(reverseDrawingOrder: Boolean, @Nullable transformer: ViewPager.PageTransformer)(source)

Sets a PageTransformer that will be called for each attached page whenever the scroll position is changed. This allows the application to apply custom property transformations to each page, overriding the default sliding behavior.

Note: By default, calling this method will cause contained pages to use LAYER_TYPE_HARDWARE. This layer type allows custom alpha transformations, but it will cause issues if any of your pages contain a android.view.SurfaceView and you have not called setZOrderOnTop to put that android.view.SurfaceView above your app content. To disable this behavior, call setPageTransformer and pass LAYER_TYPE_NONE for pageLayerType.

Parameters

reverseDrawingOrder

true if the supplied PageTransformer requires page views to be drawn from last to first instead of first to last.

transformer

PageTransformer that will modify each page's animation properties


open fun setPageTransformer(reverseDrawingOrder: Boolean, @Nullable transformer: ViewPager.PageTransformer, pageLayerType: Int)(source)

Sets a PageTransformer that will be called for each attached page whenever the scroll position is changed. This allows the application to apply custom property transformations to each page, overriding the default sliding behavior.

Parameters

reverseDrawingOrder

true if the supplied PageTransformer requires page views to be drawn from last to first instead of first to last.

transformer

PageTransformer that will modify each page's animation properties

pageLayerType

View layer type that should be used for ViewPager pages. It should be either LAYER_TYPE_HARDWARE, LAYER_TYPE_SOFTWARE, or LAYER_TYPE_NONE.