如何在Android中进行放大/缩小VideoView? [英] How to perform zoom in/out on VideoView in android?

查看:1025
本文介绍了如何在Android中进行放大/缩小VideoView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VideoView和放大器;从资源运行的视频。

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?

推荐答案

确定我有这个问题,并通过删除VideoView解决它,用的 TextureView 。那么你可以申请一个矩阵改造,其中包括大量的选项,包括变焦。

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.

的方法,我会用矩阵是分频器()方法。您可以将多个效果pre和后,您可以查看文档。

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.

修改

下面是我们使用正在运行的项目定制VideoView。您可以decalre它在XML布局,它有一个调用的函数 setMatrix()这需要一个矩阵参数。原来的code是由亚历克斯·罗斯,我们再修改了它要处理的矩阵功能。

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

这篇关于如何在Android中进行放大/缩小VideoView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆