wvrossem
wvrossem

Reputation: 107

How to get correct imageview coordinates with moveable image

I would like to be able to view a rather large image (floor plan) that can be fully viewed by moving around the picture. When I click on the image, I would also like to get the coordinates on that image.

I've followed this tutorial 1 which works correctly and so allows me to move around the image. After that I also added some functionality to get the position of where I touch the screen. However, when moving around the image, black borders surround it (see picture below), which causes me to get incorrect coordinates.

So would somebody know how I could a) fix/remove the black borders when moving the image or b) correct the coordinates I receive by e.g. removing the border offset?

Before moving the imageAfter moving the image

1 http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-2-building-the-touch-example/1763

Upvotes: 1

Views: 1477

Answers (1)

slybloty
slybloty

Reputation: 6526

When you move around the image, set the scroll to stop before it reaches the edges of the image. Use this link for further details.

As for your coordinates, check these other 2 links: link1, link2.

Hope these would help you.

Upvotes: 1

Related Questions