Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform zoom in/out on VideoView in android?

I am using VideoView & running videos from resources.

I want to know, is there any way by which I can perform zoom in/out functionality on running video?

like image 478
Arun Badole Avatar asked Dec 09 '13 10:12

Arun Badole


People also ask

How do you zoom in and zoom out on Android?

Pinch 2 or more fingers together or apart to adjust zoom. To zoom temporarily, quickly tap the screen 3 times and hold down your finger on the third tap. Drag your finger to move around the screen. Lift your finger to zoom out.

How to zoom in and out image in android studio?

Android App Development for Beginners This example demonstrates how do I Zoom In and Zoom Out an android ImageView. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How do you zoom on an android?

Tap anywhere on the screen, except the keyboard or navigation bar. Drag 2 fingers to move around the screen. Pinch with 2 fingers to adjust zoom.

How do I pinch zoom on Android emulator?

The pinch key on the emulator is the Alt key. Hold down Alt and click and drag your mouse button.


1 Answers

OK I had this issue and solved it by removing the VideoView and replaced it with a TextureView. You can then apply a Matrix transformation which includes lots of options including zooming.

The method for the Matrix I would use is the postScale() method. You can apply multiple effects pre and post, which you can view in the documentation.

Edit

Here is a custom VideoView from a running project that we used. You can decalre it in XML Layouts and it has a function called setMatrix() which takes a Matrix argument. The original code was written by Alex Ross, we then modified it to deal with the Matrix functionality.

http://pastebin.com/KwQvBWs1

like image 124
Graham Smith Avatar answered Sep 26 '22 15:09

Graham Smith