I currently have an app with a regular layout of buttons and widgets. On top of this I'd like to draw some animated sparks and particles and whatnot going on in response to events, so I've got it in a FrameLayout
with another View
on top to draw the animations. The problem is I can't work out a way of getting smooth movement out of it. I've tried a few options:
SurfaceView
: because of the way it takes over the screen, you can't see anything behind aSurfaceView
so the background is fully black.- Override
View.onDraw
and callinvalidate()
: this almost works, but invalidate isn't a very reliable way of getting a redraw to happen soon, so the motion is very jerky. Animation
framework: Testing withTranslateAnimation
, it seems a bit smoother than usingonDraw()
, but animations are designed to run for a specific duration and I want to draw indefinitely.
Anybody know any tricks to make one of these work properly, or something completely different?