0

I'm trying to get rounded corners for this VideoView. But I can't, I tried wrapping it in a FrameLayout, but no luck. Video overflow from the outline and does not respect the parent outline.

Here's the image.

enter image description here

Layout code:

        <FrameLayout
            android:id="@+id/media_video"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="@drawable/video_view_bg"
            android:clipToChildren="false"
            app:layout_constraintHeight_default="percent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <VideoView
                android:id="@+id/media_video_item"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>
        </FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/white" />
    <corners android:topRightRadius="24dp"
        android:topLeftRadius="24dp"/>
</shape>
Jason
  • 1

2 Answers2

0

To make rounded corner for video view you can use the code below. Just wrap your videoView with cardView

<androidx.cardview.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="300dp"
    app:cardCornerRadius="12dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <VideoView
        android:id="@+id/videoView"
        android:layout_gravity="center"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</androidx.cardview.widget.CardView>
Ammar Abdullah
  • 802
  • 4
  • 8
  • 21
0

You can check how to create rounded corner videoview in android?

OR you can check : How should I override VideoView's onDraw in order for it to have transparent rounded corners?

so possible you achieve your goal.

nipa
  • 39
  • 1
  • 8