AnimationListener和AnimatorListener有什么区别?

jwi*_*ir3 2 animation android

我想使用AnimatorListenerAdapter,在这里指定:

http://developer.android.com/reference/android/animation/AnimatorListenerAdapter.html

但是,它实现了AnimatorListener接口.在View诸如a之类的a上ImageView,有一个叫做的方法setAnimationListener(),但它需要一个参数作为参数AnimationListener.似乎没有可用的关联AnimationListenerAdapter.

我的问题是AnimatorListener和之间有什么区别AnimationListener,为什么存在两个独立的接口?看起来他们都提供相同的功能.我能看到的唯一区别是其中一个是在后来的API版本中引入的.

kco*_*ock 5

AnimationListener用于旧式View动画,而AnimatorListener用于新的(从3.0开始)AnimatorAPI.

所有这些AnimatorListenerAdapter都是实现AnimatorListener没有功能的接口.您可以AnimationListenerAdapter通过创建一个AnimationListener没有功能的公共非final类来轻松地以相同的方式创建自己的类.