zoukankan      html  css  js  c++  java
  • 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/

  • 相关阅读:
    flex 只显示年、月的日期选择控件(TimeChooser)
    SQL 实现统计业务
    SQL 时间函数详解
    我与计算机
    ISE中FPGA的实现流程
    总结Verilog中always语句的使用
    VGA 时序标准
    ChipScope软件使用
    FIFO的使用场景
    Verilog 初级入门概念
  • 原文地址:https://www.cnblogs.com/liyiran/p/6101526.html
Copyright © 2011-2022 走看看