开发者

display transparent view over existing views

开发者 https://www.devze.com 2023-03-16 06:23 出处:网络
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

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).


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消