Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find position of ImageView relative to the image it's displaying

Tags:

android

image

So here's the problem. I am displaying a big image in ImageView and need to find it's position relative to the image. Like this:

╔═══════════════════════════════╗
║ Image                         ║ 
║──>╔═════════════╗             ║
║   ║ ImageView   ║             ║
║   ║             ║             ║
║   ╚═════════════╝             ║
║                               ║
║                               ║
╚═══════════════════════════════╝

Any help?

UPD: Since there were some misunderstandings I will explain the problem in detail.

I have an image. A Bitmap actually. I am displaying it in an ImageView with CENTER scale type. Assume that the image is bigger than the ImageView, so only a part of the image is displayed. I want to find the position of this part relative to the whole image.

like image 326
F0RR Avatar asked Jan 07 '10 17:01

F0RR


1 Answers

getTop() , getLeft() on the child view won't solve it ? And if views are not parent-child , but have same parent - do it for each view and do the math

like image 191
Alex Volovoy Avatar answered Nov 13 '22 13:11

Alex Volovoy