I want to make a surface view which can have rounded corners. This surface view will be useful to render the video camera.
I have already tried adding the surface view in the CardView with this code.
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cvCard"
android:layout_width="150dp"
android:layout_height="150dp"
android:clipChildren="true"
android:clipToPadding="false"
app:cardCornerRadius="15dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false">
<Surfaceview is Added Programatically>
</android.support.v7.widget.CardView>
The result of this code is this image . As you can see in the round corners the surface view is still visible. It is not entirely round within the card view and it always comes in rectangle shape.
So is there any way to achieve the rounded corner Surfaceview?
You can not change directly surface view
corner (Shape). But you can change your CardView
corner by using
app:cardCornerRadius="10dp"
app:cardPreventCornerOverlap="false"
and set the SurfaceView
match_parent
that can cover the cardView
.
Why you cannot change surface view shape? The answer is here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.