• Android:ViewPager 切换动画效果


    ViewPager 可以设置不同页面切换效果,通过方法 setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) 实现。

    其中第二个参数 PageTransformer 是关键

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

     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都已经看不到了

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

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

  • 相关阅读:
    Linux C多线程实现生产者消费者
    数据库视图创建学习
    jsp生成好看的验证码
    每日英语
    ES6学习笔记(一)——let和const
    dataTables的导出Excel功能
    jquery生成二维码图片
    angular2表单初体验
    echarts系列之动态加载数据
    js刷新页面方法
  • 原文地址:https://www.cnblogs.com/liyiran/p/6101526.html
Copyright © 2020-2023  润新知