So I have a GLSurfaceView in my app being rendered by a GLSurfaceView.Renderer and using JPCt as library.
The surface is in an invisible RelativeLayout (visibility: gone). When I change the visibility to “visible” then back to “gone”, the layout shows and hides as expected, but the GLSurfaceView don’t, it just shows and won’t hide, even though I can click on items that are now “behind” it.
It seems like some graphical buffer issue, but I didn’t find a way to get this to work… any ideas?
Thanks!
SurfaceView(andGLSurfaceViewby extension) are interesting beasts in Android. Citation from Android javadoc:Android has a built-in window compositor (window has a bit different meaning here). Your status bar is a window, your activity has one window. But if your activity contains a surface view, another window is created, just to hold the surface, and android compositor draws the window with your views over the surface window. So the
SurfaceViewis really only a transparent area. When you hid it, the area is not drawn, does not react to touches, but the surface window is still present, android is not clever enough to hide the window.I would recommend two solutions
GLSurfaceViewand callonDetachedFromWindow()when visibility changes toGONE. I have not tested this and it might not work.