Recently I was playing with VideoView of Android SDK and my video was not displaying on the complete screen. It was varying device to device leaving some blank screen around depending upon the screen resolution of those devices. By default, Android will scale the video to fit the VideoView but keep the video aspect ratio. That means that depending on the device’s screen size there might be some black spaces left around the video as it’s not filling the screen.
You may want to display video in parent container area in full width and height but VideoView doesn’t provide an explicit way to specify the filling mode, you can achieve the same result by wrapping the video view in a RelativeLayout and setting the VideoView alignments to match the parent’s boundaries:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">
Here is the output of above code with RelativeLayout as well as with LinearLayout.