I need to show an image which is actually a map with coloured areas, also I need to be able to:
1. zoom in and out using two fingers
2. scroll the image as it is bigger than screen
3. clicks on the image, get clicked area pixel value(color), so that I know which area the user clicks
I searched many hours, tried many approaches:
1. Write a class that extends View, and display a Bitmap, I found a thread in the forum about it, but there is no zoom, and the scroll is not natural.
2. Use a WebView to display HTML file that contains the image, so there is zoom and scroll functionalities, however, I cannot control the limit of zoom in/out, also, when the user clicks, I’m not sure if I can get the position on the image map by adding scrollX, scrollY with touchX, touchY. As the image may be scaled up/down, also, there may be paddings that WebView adds to its content.
This really drives me crazy, can anyone help?
I believe you can create an instance of this for your WebView. From what I’ve been reading, the WebView is the correct way to do it. Finding ways to control zoom is all you have to do and ScaleGestureDetector seems to provide the functions to allow you to do so.