Skip to content

The PageTransformer library which support ViewPager and ViewPager2. 支持 ViewPager 和 ViewPager2 的 PageTransformer

License

Notifications You must be signed in to change notification settings

vejei/PageTransformer

Repository files navigation

PageTransformer

Version License Min SDK Last Commit

The PageTransformer library which support ViewPager and ViewPager2.

Quick Start

Add dependency

dependencies {
    implementation 'io.github.vejei.pagetransformer:pagetransformer:x.y.z'
}

Set up

If you don't need any configuration use SimplePageTransformer directly, passing in the required transformer name.

// ViewPager
ViewPager viewPager = view.findViewById(R.id.view_pager);
viewPager.setPageTransformer(false, new SimplePageTransformer(SimplePageTransformer.CUBE_INSIDE));

// ViewPager2
ViewPager2 viewPager = view.findViewById(R.id.view_pager2);
viewPager.setPageTransformer(new SimplePageTransformer(SimplePageTransformer.CUBE_INSIDE));

Or if you need any configuration, like the cube camera distance, construct the corresponding transformer object:

// ViewPager
ViewPager viewPager = view.findViewById(R.id.view_pager);
viewPager.setPageTransformer(false, new CubeInsideTransformer(20));

// ViewPager2
ViewPager2 viewPager = view.findViewById(R.id.view_pager2);
viewPager.setPageTransformer(new new CubeInsideTransformer(20));

For detailed examples, see the samples app.

List of PageTransformerName

The all PageTransformerName of the SimplePageTransformer including:

  • CUBE_INSIDE
  • CUBE_OUTSIDE
  • DEPTH
  • FADE_SLIDE
  • FADE
  • FAN
  • GATE
  • ROTATE_DOWN
  • ROTATE_UP
  • ROTATE_HORIZONTAL
  • ROTATE_VERTICAL
  • SCALE
  • SIDE_BY_SIDE
  • STACK_BOTTOM
  • STACK_TOP
  • ZOOM_IN
  • ZOOM_OUT

List of transformers

All currently available transformers including:

  • CubeInsideTransformer
  • CubeOutsideTransformer
  • DepthTransformer
  • FadeSlideTransformer
  • FadeTransformer
  • FanTransformer
  • GateTransformer
  • RotateDownTransformer
  • RotateUpTransformer
  • RotateHorizontalTransformer
  • RotateVerticalTransformer
  • ScaleTransformer
  • SideBySideTransformer
  • StackBottomTransformer
  • StackTopTransformer
  • ZoomInTransformer
  • ZoomOutTransformer

Change Log

Change Log

License

MIT

About

The PageTransformer library which support ViewPager and ViewPager2. 支持 ViewPager 和 ViewPager2 的 PageTransformer

Topics

Resources

License

Stars

Watchers

Forks

Languages