Please help me
I’m developing an android application to display a pinch zoom-able and drag-able bit map in a image view(Image view’s boundaries are same as device screen size). I’m only zooming the bit map and show it in the image view
What I want is
When click a place on the device screen get that X an Y positions and draw a dot exactly in the place where I clicked on the bitmap
Its like marking your location on the bit map
Here is a descriptive image (Sorry I couldn’t upload it to here because i have low reputation)
http://www4.picturepush.com/photo/a/9321682/img/9321682.jpg
as the image displays i want to get the x2, y2 positions of image view and draw the red dot in x1,y1 position on the bit map
It will be very help full for me if you can give me some codes or advice
thank you
In order to catch the coordinates of the touch, use the
onTouchevent of the imageView:where
dx, dyis the displacement of the bitmap in the imageView.edit
The values of
dxanddydepend on your settings of the imageview, which you have set yourself. If the bitmap is always centered and not screen-filling,dy= (imageview_height - bitmap_height) / 2anddx= (imageview_width - bitmap_width) / 2. If the image is scaled to fit in the imageview, you have to determine the scale factor. You can read about those computations here.