Put the SurfaceView into a FrameLayout, then put another View on top of it, either with a PNG mask, or a shape xml drawable.
Android round surface view for video recording
-
21-07-2023 - |
Question
Is there a possibility to have a round surface view instead a rectangle one? If the output is 640x480 it isnt a problem.
Thanks in advance.
La solution
Autres conseils
Simply add surfaceview inside of Cardview and add below parameters :
app:cardCornerRadius="@dimen/_200sdp"
app:cardPreventCornerOverlap="false"
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.daasuu.sample.SquareActivity">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="@dimen/_12sdp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:cardCornerRadius="@dimen/_200sdp"
app:cardPreventCornerOverlap="false">
<!--Add here surfaceview or textureview -->
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow