问题
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?
回答1:
You missed to google.
http://android-er.blogspot.com/2010/05/android-surfaceview.html
http://www.droidnova.com/playing-with-graphics-in-android-part-v,188.html
回答2:
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);
来源:https://stackoverflow.com/questions/3534452/surfaceview-setbackground-dominates-my-canvas