How to draw a polygon like google map in android app?

扶醉桌前 提交于 2019-12-10 21:47:54

问题


I am creating a map app for a place for my city and i want to draw a polygon around that place.
i have a example of my app idea in web google map like this picture:
How can i do like this ?


回答1:


Original documentation has clear explanation for Polygon API. All that you need to do is use this method with own coordinates and colors:

GoogleMap map;
// ... get a map.
// Add a triangle in the Gulf of Guinea
Polygon polygon = map.addPolygon(new PolygonOptions()
    .add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3, 5), new LatLng(0, 0))
    .strokeColor(Color.RED)
    .fillColor(Color.BLUE));


来源:https://stackoverflow.com/questions/45803711/how-to-draw-a-polygon-like-google-map-in-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!