1

In Android 2.2, I want to display a few sprites and clickable animations over an existing view. I just discovered that SurfaceView cannot be transparent

I tried overriding dispatchDraw() of a LinearLayout but that doesn't seem to be callable via a Runnable Thread.

I also tried to extend Canvas directly, but that quickly turned into a mess when trying to place it in my XML layout.

Do I have to use GLSurfaceView to have a drawing view whose background is transparent?

Optimally, I'd like to just have a Canvas on which I can draw Bitmap at various coordinates, instead of dealing with the details of GL (unless GL is the only way I can do transparency).

Community
  • 1
  • 1
Thunder Rabbit
  • 5,405
  • 8
  • 44
  • 82

2 Answers2

1

Silly Rabbit. Just use Views and move them around wherever you want within a FrameLayout. SurfaceView is not designed for what you're trying to do.

Thunder Rabbit
  • 5,405
  • 8
  • 44
  • 82
0

I'm going to try Switching from Canvas to OpenGL and toss in parts of TranslucentGLSurfaceView.

I'm still open to selecting an answer that doesn't require OpenGL, just for the sake of it solving my original question.

Thunder Rabbit
  • 5,405
  • 8
  • 44
  • 82
  • OpenGL ES will work really great in HoneyComb (3.0+). I'm not sure if Google will backport OpenGl ES for versions < 3.0. Translucence is attainable tho, but is quite hacky. – Reno Jun 30 '11 at 02:41