Search code examples
androidonclickimageviewpinchzoom

Setting points to click on my Map ImageView


I have a blueprint image in my app. The user will be able to click on some pre-established points and after they click on this point, a dialog will show some information.

My question is how I add the specific points in my ImageView Blueprint and the click function on these points?

EDIT 08/08/2014

My ImageView now has pinch zoom and the app will have more than 1 blueprint.

Thanks and regards!


Solution

  • You could go about this multiple ways. If your blueprint is full screen on the users device then you could create your own custom layout to encapsulate the imageview and override the ViewGroup's onDraw an onTouch methods to add your points. Then you could have a method like

    public void addPoints(float[] points) { // do something here }
    

    Another option is to extend the ImageView itself and make your own custom imageview and then again override onDraw and overlay the points ontop of the image. YOu can set the bitmap (your blueprint) as the background and then drop ontop of that. You would have to figure out where the specific points are though depending on the size of your image and the device, unless you set the size to be pixel density independent.