开发者

How to animate Bitmap on Surface view onDraw()?

开发者 https://www.devze.com 2023-02-01 01:49 出处:网络
I am trying to make a game. I try to use GridView but wonder how can I drag Item onTouchEvent().I found an example

I am trying to make a game. I try to use GridView but wonder how can I drag Item onTouchEvent(). I found an example http://www.droidnova.com/playing-with-graphics-in-android-part-ii,160.html

It is a great example. I cropped my image in 12 small image bitmap. display them on screen randomly on specific position. By overriding the onTouchEvent() I got my requirement. Now I want to animate my image as the "swap" other image by animating. I have both images X,Y location. I am wondring if it can by done by some Animation class.So that I should not put effort for doing it manually. I know it is not a hard job. But I Animation class can do it more smoothly. So I have a ArrayOfImages(Bitmap) and I want to swap 2Images wit开发者_Go百科h animation. I am using a thread that update "Canvas" in background. Please help me. . I more thing. How can I add Scroll view with surface holder?? Is it possible? Because I think when I try to drag my image , It my not drag and active scrollbar for this response?


Finally I am using a loop for a specific x,y to a specific x,y while updating the canvas. Although this is not a efficient way.

0

精彩评论

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

关注公众号