Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my animation leaving a trail?

I'm animating a an ImageView from the left to the right of the screen using a translate animation. The ImageView is place inside a RelativeLayout over the top of my main layout using FrameLayout.

When I run the animation on the emulator everything works pretty well but when I use run it on my G1 it leaves visual artifacts behind and effects the rendering of the text component behind it.

Is this a performance issue and I'm being too ambitious or is it a bug I can overcome?

If it is a performance issue is there anything I can do to improve things?

like image 316
Tom Martin Avatar asked Jun 18 '09 20:06

Tom Martin


3 Answers

I was also experiencing the same issue on 2.3.

Invalidating the container of the moving view ( the layout in which the moving view resides ) in Animation.applyTransformation fixed it for me.

See:

Android - Artifacts using Animation

like image 146
Matthijs Avatar answered Nov 18 '22 17:11

Matthijs


I now this may be a little old, but I just found this:

http://groups.google.com/group/android-developers/browse_thread/thread/5481450f8b71a26c/e750730b9953d9a8?lnk=gst&q=animation+leaves+trails#e750730b9953d9a8

Not sure what android version your using, but it may be a bug in the android libraries!

Looks like that's what the problem is for me! :)

... Dontcha just love it when its not your fault! :D

like image 21
Andy Avatar answered Nov 18 '22 15:11

Andy


Here's a workaround I found that solved this for me: "An easy workaround would be to pad your image with a small (1 pixel should do it) transparent region on the right/bottom - this would have no effect on how it would look, but it would force an invalidation of a region slightly larger than the actual image and thus compensate for the bug."

http://code.google.com/p/android/issues/detail?id=22151

like image 2
Brian Christensen Avatar answered Nov 18 '22 16:11

Brian Christensen