当前位置:操作系统 > 安卓/Android >>

Android同时播放缩放动画和位移动画

Animation mScaleAnimation = new ScaleAnimation(0.5f, 1.0f, 0.5f,
                1.0f,// 整个屏幕就0.0到1.0的大小//缩放
                Animation.INFINITE, 0.5f,
                Animation.INFINITE, 0.5f);
        mScaleAnimation.setDuration(1000);
        mScaleAnimation.setFillAfter(true);

        Animation mTranslateAnimation = new TranslateAnimation(-100*SetRobot2Activity.mDensity,0, -15*SetRobot2Activity.mDensity, 0);// 移动
        mTranslateAnimation.setDuration(1000);
        AnimationSet mAnimationSet=new AnimationSet(false);
        mAnimationSet.addAnimation(mScaleAnimation);
        mAnimationSet.setFillAfter(true);
        mAnimationSet.addAnimation(mTranslateAnimation);
        iv.startAnimation(mAnimationSet);

 

 

摘自 liuxiIT的专栏

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,