如何覆盖 PhotoView 的双击

How to override doubletap of PhotoView

我想在双击后设置 scale=4

在 onCreate() 中:

         imageView = (ImageView)rootView.findViewById(R.id.imageView1);
         mAttacher = new PhotoViewAttacher(imageView);
         imageLoader.displayImage(globalWallImages.get(position).preview, imageView, options);
         mAttacher.setOnDoubleTapListener(this);

我正在设置 mAttacher.setOnDoubleTapListener(this); 并在此接口的方法中执行此操作:

public boolean onDoubleTap(MotionEvent e) {
        Log.e("","onDoubleTap");
        mAttacher.setScale(4);
        return true;
    }

但图像不想缩放

找到解决方案

默认 MaximumScale < 4,所以我添加:

mAttacher.setMaximumScale(5f);