I want to put a transparent SurfaceView on top of an ImageView. I have the following in the SurfaceView subclass constructor
setZOrderOnTop(true); // necessary
SurfaceHolder h = getHolder();
h.setFormat(PixelFormat.TRANSPARENT);
I also have this in the beginning of the onDraw() function
canvas.drawColor( 0, PorterDuff.Mode.CLEAR );
Yet, all I get is a black background which blocks the image.
Any ideas?
PS, I also tried this instead of drawColor(), but to no avail
Paint paint = new Paint();
paint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
canvas.drawPaint(paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC));