I am trying to show an animation on a canvas when user touches to the screen.I know basics and how to draw a bitmap on to canvas but i couldn't find anything good on drawing or showing animation on canvas.i will use frame by frame animation and it will appear at the same position user touched that is why i can't use ImageView.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Not sure if there is a built-in way of doing this. But it's fairly straightforward to simply load the bitmaps into an array.
Then call invalidate(), your onDraw() method should invalidate() itself and on the next run calculate which frame to display (by calculating the time the last frame was displayed). Every time you play a frame you increase the frame counter and reset the time counter.
You can use a variable delay, and it's fairly easy to implement.