温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ViewPager如下效果你研究过吗

发布时间:2020-05-28 05:24:00 来源:网络 阅读:222 作者:杨光成 栏目:移动开发

                

                   

1:ViewPager实现欢迎页面动画效果

ViewPager实现欢迎页面动画滑动切换view效果,页面切换添加优美的动画,

//主要代码实现

public void animateSecondScreenClock(float position) {

        if (mCurrentDirection == Path.Direction.CCW) {
            mCurrentDirection = Path.Direction.CW;
            //animPath.reset();
            initNewPath(Path.Direction.CW);
            invalidate();
        }

        if (Math.abs(position) > 1) {
            mDistance = mPathLength / 2 * (Math.abs(position));
        } else {

            mDistance = mPathLength / 2 * (Math.abs(position));
        }
        invalidate();
    }

    public void animateSecondScreenAntiClock(float position) {

        if (mCurrentDirection == Path.Direction.CW) {
            mCurrentDirection = Path.Direction.CCW;
            initNewPath(Path.Direction.CCW);
            invalidate();
        }

        if (Math.abs(position) > 1) {

        } else {

            mDistance = mPathLength / 2 * (Math.abs(1 + position));
        }
        invalidate();


    }

ViewPager如下效果你研究过吗

 

 

本项目来自:http://www.itlanbao.com/code/20151010/10000/100571.html
 

///////////////

2:viewpager切换添加动画效果

viewpager切换添加动画效果,本项目中主要有三种切换特效,
(1):DepthPageTransformer 效果
(2):RotateDownPageTransformer 每一个view切换的时候旋转
(3):ZoomOutPageTransformer 效果
主要实现代码:
  mViewPager.setPageTransformer(true,new ZoomOutPageTransformer());
  mViewPager.setPageTransformer(true,new RotateDownPageTransformer());
  mViewPager.setPageTransformer(true,new DepthPageTransformer());
这三句实现这三个效果,其中每一个类都封装好了,直接可以使用。

ViewPager如下效果你研究过吗

 

本项目来源:http://www.itlanbao.com/code/20151111/10000/100638.html

                                               




向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI