20

帧动画内存OOM?不存在的!—— SurfaceView逐帧解析

 5 years ago
source link: https://juejin.im/post/5ccc1dcbe51d456e8b07ddf4
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Android 提供了AnimationDrawable用于实现帧动画。在动画开始之前,所有帧的图片都被解析并占用内存,一旦动画较复杂帧数较多,在低配置手机上容易发生 OOM。即使不发生 OOM,也会对内存造成不小的压力。下面代码展示了一个帧数为4的帧动画:

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK