Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VideoView Full screen in android application

Tags:

android

i have a videoview in my application. the code is like this.

<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent">  <LinearLayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@drawable/opsbuds"     android:orientation="vertical">      <TextView         android:id="@+id/adtxt1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="TextView"></TextView>      <VideoView         android:id="@+id/videoView11"         android:layout_width="300dip"         android:layout_height="250dip"         android:layout_marginLeft="30dip"></VideoView>      <LinearLayout         android:id="@+id/llv11"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="vertical"></LinearLayout>      <Button         android:id="@+id/button1211"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginLeft="5dp"         android:layout_marginTop="10dp"         android:background="@drawable/button"         android:text=" Continue "         android:textColor="#800080"         android:textSize="20dp"         android:textStyle="bold"></Button> </LinearLayout> </ScrollView> 

the video view width and hieght is mentioned in xml file. What i want is , once i press a button the videoview should come on full screen and once i press back button the videoview should go back to its mentioned size. please help?

like image 813
Cool Compiler Avatar asked Jul 03 '12 12:07

Cool Compiler


People also ask

How do I make Android videos full screen?

Tap the video you'd like to watch. At the bottom of the video player, tap full screen .


1 Answers

I had to make my VideoView sit in a RelativeLayout in order to make the chosen answer work.

<?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> 

As given here: Android - How to stretch video to fill VideoView area Toggling between screen sizes would be as simple as changing the layout parameters as given in the chosen answer.

like image 88
Srikanth Avatar answered Sep 28 '22 19:09

Srikanth