Android: how to detect touch location on ImageView if the image view is scaled by matrix?

Try using getRawX() and getRawY(). Note that this is not adjusted for the size of the view, so you may have to offset if the app isn't fullscreen.

GetX and getY will return the touch location in the ImageView's coordinate system. If you're looking for the point within the image's coordinate system, you can use the inverse matrix of the matrix used by the ImageView. I've done something like the following: // calculate inverse matrix Matrix inverse = new Matrix(); imageView.getImageMatrix().

Invert(inverse); // map touch point from ImageView to image float touchPoint = new float {event.getX(), event.getY()}; inverse. MapPoints(touchPoint); // touchPoint now contains x and y in image's coordinate system.

GetX and getY will return the touch location in the ImageView's coordinate system. If you're looking for the point within the image's coordinate system, you can use the inverse matrix of the matrix used by the ImageView. Try using getRawX() and getRawY().

Note that this is not adjusted for the size of the view, so you may have to offset if the app isn't fullscreen. Terms of service. Not the answer you're looking for?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions