Android框架的哪一部分负责播放动画?
与此问题相关,我试图找出 Android 类库中负责播放 Animation
的部分。查看源代码,动画类似乎只是计算动画对象所经历的变换,但它们不负责实际“播放”动画,即以给定的帧速率将变换后的对象渲染到屏幕上。
一段时间以来,我一直在筛选 View
和 ImageView
的源代码,但我无法确定实际将每个转换绘制到屏幕上的代码所在的位置。
有什么想法吗?
澄清一下,我知道为了播放动画,您只需将其粘贴在 View
中并调用 startAnimation
,但我想了解 的哪些部分code>View
或相关类实现这些位。
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 which parts of View
or related classes implement these bits.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你应该看看 android 代码。从
View
类的startAnimation
方法开始。我认为,在视图类中,应用转换后,它会调用invalidate()
,将其余部分留给图形引擎。android 文档说
在此处获取完整摘要
You should look into the android code. Start at
startAnimation
method of theView
class. I think, in view class, after applying the transformation it callsinvalidate()
which leaves the rest to the graphics engine.The android docs say
Get the whole summary here