0

I want to have a video background on my entire screen. Everything works correctly in java: it loops etc. The problem might be in xml. Currently I have video on a top of the screen, it looks like this: (Video is perfeclty fitted in edges)enter image description here

While my purpose is to have it entirely in my screen: enter image description here

Please what should i make my xml look like to achieve my goal. Thanks.

XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<VideoView
    android:id="@+id/surface"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
/>
</FrameLayout>
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Old York
  • 73
  • 1
  • 9

1 Answers1

1

First you need to set the orientation to landscape since you said you purpose is in landscape mode

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // add it below super.oncreate

If this code not working check out this link

or your could set the orientation in manifest just google it

And change this in your xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<VideoView
    android:id="@+id/surface"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
/>
</FrameLayout>
Community
  • 1
  • 1
teck wei
  • 1,375
  • 11
  • 22
  • I don't want to change my screen orientation to landscape, but to make something to make my Videoview on entire screen. Currently i have this video on the top of my screen – Old York Dec 19 '16 at 21:46