千变万化的ViewPager切换动画(三、自定义ViewPager的实现方法)

关于这学习的内容,以小编目前的功力还不能用文字叙述清楚,所以,我推荐直接去看视频容易理解一些。

视频地址:http://www.imooc.com/video/6101

当然,也可以去细细品味一下鸿洋大神的博客:http://blog.csdn.net/lmj623565791/article/details/38026503


关于这次涉及到的ViewPager中的onPageScrolled方法是关键,这里贴出该方法的注释。

/**
     * This method will be invoked when the current page is scrolled, either as part
     * of a programmatically initiated smooth scroll or a user initiated touch scroll.
     * If you override this method you must call through to the superclass implementation
     * (e.g. super.onPageScrolled(position, offset, offsetPixels)) before onPageScrolled
     * returns.
     *
     * @param position Position index of the first page currently being displayed.
     *                 Page position+1 will be visible if positionOffset is nonzero.
     * @param offset Value from [0, 1) indicating the offset from the page at position.
     * @param offsetPixels Value in pixels indicating the offset from position.
     */
    @Override
    protected void onPageScrolled(int position, float offset, int offsetPixels){}

还有,在最后也提到了一个开源项目JazzyViewPager.java,它的原理也和本次所要学习的内容差不多,不过它实现了12种动画效果,可以很方便的直接拿来用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值