I use this XML layout to show a fullscreen VideoView on my activity. The Video is fullscreen but it isn\'t centered. In landscape mode, it stays on the left side of the scre
You need to have two different layouts. One for the portrait and the one for the landscape. Create two xml files with the same name and put them into folders "layout-land" for landscape and "layout-port" for portrait.
And Here you can take a look how to handle orientation changes.
This can be the layout to make video view full screen.
3 down vote accepted
You need to have two different layouts. One for the portrait and the one for the landscape. Create two xml files with the same name and put them into folders "layout-land" for landscape and "layout-port" for portrait.
And Here you can take a look how to handle orientation changes.
This can be the layout to make video view full screen.
Try this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView android:id="@+id/myvideoview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true">
</VideoView>
</RelativeLayout>
Hope this helps.
Try this layout,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center">
<VideoView android:id="@+id/videoview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</RelativeLayout>
If your VideoView cannot center in RelativeLayout you can try to put it into a FrameLayout like this:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
</VideoView>
</FrameLayout>
And then put this into RelativeLayout.