android - 将坐标映射到imageview

时间:2016-04-09 16:15:35

标签: android

我已经用它将我在Imageview上标记的坐标映射为位图本身的坐标。

final 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;
}

我需要编写一个函数来接收坐标并将它们映射到Imageview,以便在其上标记一些点(在我做了一些计算之后)。

你能帮我吗?

0 个答案:

没有答案