Reputation: 283
How do I get the VideoView to go Fullscreen in lanscape?
I've set the following in the manifest file for the activity.
android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
Is there anything else I need to do?
Upvotes: 2
Views: 3553
Reputation: 1847
By changing the configuration of layout you can stretch your video.
<?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/videoViewRelative"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</VideoView>
</RelativeLayout>
To make the activity fullscreen you can change the theme as follows
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
Or you can do it by adding the code below before setContentView()
method in onCreate()
in the activity (java) class.
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Upvotes: 0
Reputation: 162
<?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_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_height="fill_parent">
</VideoView>
</RelativeLayout>
the align's are needed
Upvotes: 4
Reputation: 1006604
Set the VideoView
to fill the screen using android:layout_width
and android:layout_height
.
Note that the actual video will not fill the screen in most cases, because the aspect ratio of the video will not match the aspect ratio of the screen.
Upvotes: 2