Android知识回顾之动画

Android的动画分成三种:view动画,帧动画,属性动画,严格上说帧动画也是属于view动画的。

view动画的四种变化对应着Animation的四个子类:TranslateAnimation(平移动画),ScaleAnimation(缩放动画),RotateAnimation(旋转动画),AlphaAnimation(透明度动画)。

帧动画是顺序播放一组预先定义好的图片,类似电影播放。

属性动画可以是对任意属性进行动画,在API11(Android3.0)才有.比较常用的几个动画类有ValueAnimator,ObjectAnimator和Animatorset,其中ObjectAnimator继承自ValueAnimator,AnimatorSet是动画集合,可以定义一组动画。属性动画提供监听器监听动画播放过程,主要有如下两个接口:AnimatorUpdateListener和Animator

  public static interface AnimatorListener {
        /**
         * <p>Notifies the start of the animation.</p>
         *
         * @param animation The started animation.
         */
        void onAnimationStart(Animator animation);

        /**
         * <p>Notifies the end of the animation. This callback is not invoked
         * for animations with repeat count set to INFINITE.</p>
         *
         * @param animation The animation which reached its end.
         */
        void onAnimationEnd(Animator animation);

        /**
         * <p>Notifies the cancellation of the animation. This callback is not invoked
         * for animations with repeat count set to INFINITE.</p>
         *
         * @param animation The animation which was canceled.
         */
        void onAnimationCancel(Animator animation);

        /**
         * <p>Notifies the repetition of the animation.</p>
         *
         * @param animation The animation which was repeated.
         */
        void onAnimationRepeat(Animator animation);
    }

 public static interface AnimatorUpdateListener {
        /**
         * <p>Notifies the occurrence of another frame of the animation.</p>
         *
         * @param animation The animation which was repeated.
         */
        void onAnimationUpdate(ValueAnimator animation);

    }


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值