如何使用缩放和平移功能创建imageview?

时间:2011-11-15 17:21:50

标签: android android-imageview

我创建了一个应用程序,其中包含从网站的URL加载的小图像。我希望当用户点击该小图片时,它会以全屏显示图像,并且还能够缩放和平移该图像。

我所做的是使用内置缩放控件在WebView中显示图像,但结果很难看。 (我已将布局设置为wrap_content,因此不会显示白色区域,但会导致图像无法动态缩放)。

任何解决方案?抱歉我的英语不好。

3 个答案:

答案 0 :(得分:11)

问题解决了!对于任何有同样问题的人,我都使用这个库而且效果很好! http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/

以下是指向the Github ImageViewZoom page的链接。

答案 1 :(得分:1)

你可以从头开始构建它......或者你可以使用这个库:

http://code.google.com/p/android-pinch

查看PinchImageView班级

答案 2 :(得分:0)

您需要使用GestureDetectors。 Google为此提供了优秀的示例interactiveChart,请参阅https://android.googlesource.com/platform/development/+/master/samples/training/InteractiveCharthttp://developer.android.com/training/gestures/scroll.html