Android:ViewPager 切换动画效果

ViewPager 能够设置不一样页面切换效果,经过方法 setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) 实现。缓存

其中第二个参数 PageTransformer 是关键this

PageTransformer 是一个接口,只有一个方法 transformPage() ,参数:第一个是view,第二个是positionspa

 1     public interface PageTransformer {
 2         /**
 3          * Apply a property transformation to the given page.
 4          *
 5          * @param page Apply the transformation to this page
 6          * @param position Position of page relative to the current front-and-center
 7          *                 position of the pager. 0 is front and center. 1 is one full
 8          *                 page position to the right, and -1 is one page position to the left.
 9          */
10         public void transformPage(View page, float position);
11     }

position的可能性的值有,其实从官方示例的注释就能看出:
[-Infinity,-1) 已经看不到了
(1,+Infinity] 已经看不到了
[-1,1]
重点看[-1,1]这个区间 , 其余两个的View都已经看不到了.net

ViewPage 有三个页面,当前显示的页面,缓存左边和右边页面,左边和右边的页面是看不到的。code

详情查看:http://blog.csdn.net/lmj623565791/article/details/40411921/orm

相关文章
相关标签/搜索