1

From what I've read I don't believe a SurfaceView can be animated but I'll ask the question:

I have a surfaceView object inside a ViewFlipper. When the ViewFlipper is animated left or right to a new "page", the SurfaceView from the prior page remains on the LCD. Kind of expected that.

Here's the question. Is there some way to solve this, even in a crude way? For example, as the ViewFlipper starts to move, could the surfaceView be made invisible or something?

SurfaceView is absolutely perfect for my needs and has solved all problems except this one remaining issue. Any ideas would be appreciated. Thanks.

Batdude
  • 556
  • 7
  • 19

2 Answers2

1

To make a SurfaveView transparent (invisible), you can call this on your canvas object before rendering it to the screen:

canvas.eraseColor(Color.TRANSPARENT);

I hope this helps.

Luke Taylor
  • 9,481
  • 13
  • 41
  • 73
0

If you use a ViewFlipper, I guess you probably need to set your own Gesture. So you can clean and stop all the SurfaceView animation job in the Gesture. (I mean you need to stop&restart your drawing Thread by Gesture.)

But ViewPager and V4.Fragment are the better solution. Because Fragment can recycle the SurfaceView. I don't know if the Fragment can work in ViewFlipper, but I just finish my job in ViewPager + V4.Fragment + SurfaceView. So I am sure it work.

hsu.tw
  • 148
  • 2
  • 10