I create an application in which 2 video streams will be displayed, they should be one above the other and the one that should have rounded edges on top. I used CardView
to round the edge of the SurfaceView
and it helps while the lower video stream is turned off.
As soon as the lower video stream is turned on, the rounding of the corners at the upper one disappears and it again becomes rectangular where the Canvas
of the other stream is underneath. How do I make sure the edges don't get straight again when one stream is playing on top of another?
I tried to put the SurfaceView in FrameLayout
in different sequences, set different backgrounds for SurfaceView
or CardView
, including just a white or transparent background, and View with a rectangle with cut edges, when setting the cardCornerRadius
parameter - SurfaceView
still went beyond CardView
. The cardPreventCornerOverlap parameter also had no effect.
I also tried to make a custom canvas, but the only thing I achieved is rounding with a white frame around the edges around the perimeter of the rectangle, I need to make sure that there is no frame.
I did something like this before, as far as i remember, if you were to switch one of the SurfaceViews to TextureView it would work. That's because the SurfaceView works differently than the other views, it's basically a transparent View which lets you see the other rendering layer while TextureView and SurfaceView works a bit differently.