Which part of the Android framework is responsible for playing animations?
Related to this question, I am trying to figure out the parts of the Android class library that are responsible for playing an Animation
. Looking at the sources, the Animation classes seem to merely compute the transformations an animated object undergoes, but they are not responsible for actually "playing" the animation, i.e. rendering the transformed object to the screen at a given frame rate.
I have been sifting through the source code of View
and ImageView
for some time now, but I can't make out where the code sits that actually draws each transformation to the screen.
Any ideas?
To clarify, I know that in order to play back an animation, you simply stick it in a View
and call startAnimation
, but I'd like to understand whi开发者_如何学运维ch parts of View
or related classes implement these bits.
You should look into the android code. Start at startAnimation
method of the View
class. I think, in view class, after applying the transformation it calls invalidate()
which leaves the rest to the graphics engine.
The android docs say
Tweened animation is handled by this package (android.view.animation); frame-by-frame animation is handled by the AnimationDrawable class.
Get the whole summary here
精彩评论