我有一个很好的工作TouchImageView,我想知道它是如何工作的代码:我只想做的是能够捏缩放,或使用双击放大我选择的任何imageview,当我缩放我返回图像的原始大小.TouchImageView.java:
public class TouchImageView extends ImageView {
Matrix matrix = new Matrix();
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
PointF last = new PointF();
PointF start = new PointF();
float minScale = 1f;
float maxScale = 3f;
float[] m;
float redundantXSpace, redundantYSpace;
float width, height;
static final int CLICK = 3;
float saveScale = 1f;
float right, bottom, origWidth, origHeight, bmWidth, bmHeight;
ScaleGestureDetector mScaleDetector;
Context …Run Code Online (Sandbox Code Playgroud)