Make clickable polygons on Google Maps (for Android)

前端 未结 3 469
一整个雨季
一整个雨季 2021-01-02 07:34

I have continuous LatLngs of various areas in a city. Is there any way I can create clickable polygons with it. Once way to go about would be to

  • Generate poly
3条回答
  •  误落风尘
    2021-01-02 08:17

    you don't need to go crazy for having clickable polygon. I did it time ago but now, there is an api for that:

    GoogleMap.setOnPolygonClickListener(OnPolygonClickListener)

    You can use it easily:

    GoogleMap mymap =....//init your map
    mymap.setOnPolygonClickListener(new OnPolygonClickListener(){
     void onPolygonClick(Polygon polygon){
       //do whatever with polygon!
     }
    });
    

提交回复
热议问题