I have VideoView and I want to draw this shape around VideoView.
I made with my xml code:
Vertical video:
Horizontal video:
My rectangle border does not correspond to the exact VideoView dimensions. When the video is horizontal, there is an overflow in the background at the top and bottom points. When vertical, there is overflow on the right and left. Their colors don't match well either.
I don't want my changes to affect the video resolution negatively.
My rectangle border xml:
<solid
android:color="@color/grey_300" />
</shape>
</item>
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp">
<shape>
<gradient
android:angle="270"
android:endColor="#ffffff"
android:startColor="#ffffff" />
<stroke
android:width="1dp"
android:color="@color/grey_300" />
<corners
android:radius="10dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
</item>
</layer-list>
</item>
and layout xml:
<RelativeLayout
android:id="@+id/view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/rect_border"
android:elevation="5dp"
android:outlineProvider="bounds">
<VideoView
android:id="@+id/video_loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:background="@drawable/bg_rounded"
android:gravity="center" />
<ImageView
android:id="@+id/icon_video_play"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
app:srcCompat="@drawable/ic_baseline_play_circle_filled_24" />
</RelativeLayout>


