Android开源控件:PhotoView的单击事件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LucasXu01/article/details/82962040

PhotoView :PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView.扩展自Android ImageView,支持通过单点/多点触摸来进行图片缩放的智能控件。

支持单点/多点触摸;缩放图片; 平滑滚动; 在滑动父控件下能够运行良好;(例如:ViewPager)

github地址:https://github.com/chrisbanes/PhotoView 


默认double click会让图片方大缩小,但是没有单击事件,找了好久终于找到,并且该方法不会和拖拽放大拉伸冲突。方法如下:

photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
            @Override
            public void onPhotoTap(View view, float x, float y) {
                ((Activity)context).finish();
            }
        });

感谢晨风的小窝提供的方法:https://blog.csdn.net/gold_brick/article/details/56834865

猜你喜欢

转载自blog.csdn.net/LucasXu01/article/details/82962040