读书人

android 图片加载解决办法

发布时间: 2012-02-28 13:06:35 作者: rapoo

android 图片加载
请教一下,android怎么加载gif图片?

[解决办法]
加载Gif图片要对图片信息进行解帧等操作。具体请参考Android应用开发揭秘中的内容。
[解决办法]
This is a common question asked by new game developers. I assume it is some sort of animation for a game. An animated GIF is simple a set of frames stored in a file, what you really want to do is to get a program from download.com or somewhere that can split your gif into separate files for each frame.

frame1.png
frame2.png
frame3.png
frame4.png

Load these files as an array of Bitmaps, then display them in sequence.

canvas.drawBitmap(frames[i], x, y, null);
i++;

Each time through your paint loop the next frame will be drawn.

读书人网 >Android

热点推荐