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?
Tap the video you'd like to watch. At the bottom of the video player, tap full screen .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With