I put an ImageView and a VideoView in a RelativeLayout.
The ImageView can be scaled to fill the whole layout by scaleType="fitXY"
. However, there is no similar scale attribute for the VideoView. By the way, I hide the video control by set setMediaController(null)
and only the video content displays. Is it possible to scale the VideoView without keep aspect ratio?
Here is the layout example.
<RelativeLayout
android:layout_width="280dp"
android:layout_height="200dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/image"
android:scaleType="fitXY" />
<VideoView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/video"
android:visibility="invisible"
android:layout_centerInParent="true" />
</RelativeLayout>
Try to put VideoView
inside RelativeLayout
and set below properties to show video in full screen :
<VideoView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/video"
android:visibility="invisible"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"/>
Note : Please set visibility value based on your requirement.