最好用的可缩放ImagView:TouchImageView

原生gallery3D应用中,在单张图片浏览的时候有图片是可以随意缩放的,而且缩放效果非常自然流畅,如果你想自己实现这样的效果不妨去试试解读gallery3D的源码。但是告诉你gallery3D的源码非常复杂,除非你是长时间做关于图片方面的开发,不然收获与付出的时间不成正比。

所幸的是github上已经有了模仿这种效果的ImageView源码,我在github上找到了三个,分别是 PhotoViewImageViewZoomTouchImageView、经过比较TouchImageView在性能上最好,也是效果最接近gallery3D的。

TouchImageView的功能有:

TouchImageView extends ImageView and supports all of ImageView’s functionality.
In addition, TouchImageView adds pinch zoom, dragging, fling, double tap zoom
functionality and other animation polish. The intention is for TouchImageView to 
mirror as closely as possible the functionality of zoomable images in Gallery 
apps.

继承自ImageView具有ImageView的所有功能;除此之外,还有缩放、拖拽、双击放大等功能,并伴有动画效果。

PhotoViewImageViewZoom 则性能不够好,而且动画也不自然,所以鼎立推荐TouchImageView