0

I'm using the following code on my XML file to play a video, but when it plays the video on the device it won't fill the whole screen with video.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >

<VideoView
    android:id="@+id/videoView"
    android:layout_width="match_parent"
    android:layout_height="fill_parent" />

</LinearLayout>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mona
  • 5,939
  • 3
  • 28
  • 33
  • 1
    for clarification, are you trying to make the video fill the whole videoview? (ie aspect ratio problems) or are you trying to make the VideoView fill the whole screen? – Glenn.nz Nov 24 '11 at 01:21

4 Answers4

2

I'm not sure this is relevant, but to make an application full screen you can use this in your activities onCreate method:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
    WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

You could also try adding the following attribute to the <activity> and/or <application> of the AndroidManifest.xml

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
TerryProbert
  • 1,124
  • 2
  • 10
  • 28
0

You can achieve it like this. change video height and width according to orientation

 <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <VideoView
            android:id="@+id/videoPlayLoop"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true" />

    </RelativeLayout>
Sandeep Parish
  • 1,888
  • 2
  • 9
  • 20
0

Answered here already. This post shows you exactly how to make an activity fullscreen. Along with this if you keep your VideoView the sole child in the layout, it should work perfectly.

another tip, if the videos are widescreen format, then in your manifest when you declare this activity that plays the video, restrict it to Landscape with the Activity tag android:screenOrientation="landscape". This will prevent the videos trying to move themselves around or get crushed by portrait mode, or potentially breaking anything that is running on the UI thread as it is interrupted when orientation is changed.

Community
  • 1
  • 1
Glenn.nz
  • 2,261
  • 2
  • 17
  • 20
  • Thanks for replying but this just made the height of the video get fitted to the screen by rotating it. there are still some black spaces left on the right side the video since the width is not filling the screen. – Mona Nov 24 '11 at 03:34
  • Thats an aspect ratio problem. Android will scale the video to fit the VideoView but it wont stretch it wider while keeping the height the same. There is nothing client-side for this, the best you can do is re-make the videos and force them into a more standard aspect ratio. Even then, android devices come in different ratios, 16:9, 16:10 ect... and a few other whacky ones that i cant think of at the moment. Unless your application can pull the current screen size, send it back to your servers, and have video dynamically resized and streamed to the device, your pretty much out of luck sorry – Glenn.nz Nov 24 '11 at 03:57
  • Thanks anyways for the advice – Mona Nov 25 '11 at 04:32
0

I think changing android:layout_width="match_parent" to android:layout_width="fill_parent" may help you.

Exhausted
  • 1,867
  • 2
  • 23
  • 33
kalpana c
  • 2,739
  • 3
  • 27
  • 47