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?
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.
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.
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.
The pinch key on the emulator is the Alt key. Hold down Alt and click and drag your mouse button.
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
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