开发者

How to dynamically create an AnimationDrawable from a tiled image

In the game I am currently programming, I have a tiled image with different animation frames in a 4x3 matrix. I would like to create an AnimationDrawable consisting of each of these frames in sequence. However, I am only aware of making animations with entire images being frames. Can someone help me as to how 开发者_运维技巧to do this? If this could be done in XML, that's even better.

Thanks!


You can use Bitmap.createBitmap to create the clipped bitmaps from the big bitmap, and use AnimationDrawable.addFrame to add the bitmap to the AnimationDrawable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜