相关疑难解决方法(0)

Android Image View Pinch Zooming

我正在使用Make Sense of Multitouch中的代码示例 来缩放图像视图.在ScaleListener上,我添加ScaleGestureDetector.getFocusX() and getFocusY()内容以缩放手势的焦点.它工作正常.

问题是,在第一次多点触控时,整个图像绘制位置将变为当前触摸点并从那里进行缩放.你能帮我解决这个问题吗?

这是TouchImageView的My Code Sample.

public class TouchImageViewSample extends ImageView {

private Paint borderPaint = null;
private Paint backgroundPaint = null;

private float mPosX = 0f;
private float mPosY = 0f;

private float mLastTouchX;
private float mLastTouchY;
private static final int INVALID_POINTER_ID = -1;
private static final String LOG_TAG = "TouchImageView";

// The ‘active pointer’ is the one currently moving our object.
private int mActivePointerId = INVALID_POINTER_ID;

public TouchImageViewSample(Context context) …
Run Code Online (Sandbox Code Playgroud)

android android-widget android-intent android-layout

59
推荐指数
5
解决办法
13万
查看次数