SurfaceView.setbackground() dominates my canvas
-
30-09-2019 - |
Question
When I set the background to my surfaceview, I see what I set as the background. However, I cannot draw simple things like circles when I lock/unlock the surfaceview's canvas. All I see is the background image.
Is there something I'm missing?
Any thoughts?
OTHER TIPS
The solution is very simple.
//get surface view and surface holder
mySurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
surfaceHolder = mySurfaceView.getHolder();
//place surface view holder on top of the surface view
mySurfaceView.setZOrderOnTop(true);
//set pixels of the surface holder to transparent to see the color of the
//surface view background
surfaceHolder.setFormat(PixelFormat.TRANSPARENT);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow