I use custom TextureView to draw animation. Drawing runs in separate thread - here is drawing code:
@Override
public void run() {
while (running) {
try {
Thread.sleep(currentFrameRate);
} catch (InterruptedException e) {
}
Canvas canvas = null;
try {
canvas = lockCanvas();
if (canvas != null)
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
drawItems(canvas);
} finally {
if (canvas != null)
unlockCanvasAndPost(canvas);
}
}
}
I use two of these controls in LinearLayout - one below other. But sometimes on some devices one control begin duplicate another if no animation in it at this moment.
Thanks for advance.
UPD: Maybe it helps - both of my views placed over SurfaceView.