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=""


Here is the output of above code with RelativeLayout as well as with LinearLayout.



This article has 3 comments

  1. Michael Scheucher Reply

    In my case it is not working… If I do it that way it is stretched to the width/height of the parent container but the ratio is not kept… So the result is awful… Do you have any ideas what I am doing wrong?!

    Thanks in advance!

  2. Warbington55757 Reply

    You are my inhalation, I have few blogs and sometimes run out from to post : (.

Leave a Comment

Your email address will not be published. Required fields are marked *