android:ViewPager动画总结

时间:2023-02-05 15:56:21

设置动画的方案:

我们能够使用ViewPager的setPageTransformer方法,为ViewPager设置动画。下面是几种常见动画的演示及效果:

1.CubeInTransformer

android:ViewPager动画总结

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvTlVQVGJveVpIQg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />

2.CubeOutTransformer

2android:ViewPager动画总结

3.FlipHorizontalTransformer

android:ViewPager动画总结

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvTlVQVGJveVpIQg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />

4.RotateUpTransformer

android:ViewPager动画总结

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvTlVQVGJveVpIQg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />

5.ZoomOutSlideTransformer

android:ViewPager动画总结

6.TabletTransformer

android:ViewPager动画总结

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvTlVQVGJveVpIQg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />

很多其它ViewPager的动画Demo请參见源码:

https://github.com/nuptboyzhb/ViewPageAnimatorDemo

未经同意。不得用于商业目的