</pre><pre name="code" class="html">// 比如我们点击图片得到的 x y 坐标是ImageView的坐标,但是我们需要的是点击的 x y 是图片的坐标
// 用这个方法就可以把ImageView的绝对坐标转换为ImageView里面图片的实际坐标点
// 例如你要在一张图像上画线,并且这个图像是可以放大缩小
public float[] getPointerCoords(ImageView view, MotionEvent e)
{
final int index = e.getActionIndex();
final float[] coords = new float[] { e.getX(index), e.getY(index) };
Matrix matrix = new Matrix();
view.getImageMatrix().invert(matrix);
matrix.postTranslate(view.getScrollX(), view.getScrollY());
matrix.mapPoints(coords);
return coords;
}