0
我使用SurfaceView
画圆像这样:如何设置SurfaceView背景透明
Canvas canvas = holder.lockCanvas();
canvas.drawColor(android.R.color.holo_blue_bright);
Paint paint = new Paint();
paint.setStrokeWidth(0);
paint.setARGB(255,255,138,253);
canvas.drawCircle(canvas.getWidth()/2, canvas.getHeight()/2, (float) (lastAmp/ 1.2), paint);
holder.unlockCanvasAndPost(canvas);
所以灰色backdround实际上是保持SurfacrView线性布局的一部分。 粉红色圆圈是我绘制的部分,黑色部分是我喜欢摆脱的部分,我希望它是透明的,并看到下面的灰色背景。
不工作我的朋友...我试图把它放在几个地方。 –
我相信你需要先清除SurfaceView(使用drawColor),然后开始绘制粉色和灰色区域。 – Alin