Tuesday, 15 September 2015

android - How to add overlays to a MapFragment? -



android - How to add overlays to a MapFragment? -

i trying add together custom overlay google maps map in program, i'm unable find method when using fragments.

all examples , guides i've been able found using mapview, , overlays can added mymapview.getoverlays().add(myoverlay).

i can't find similar method when working fragment instead of mapview. have handle googlemap, not seem contain .getoverlays(), , not having much success fragment either.

so, can i, and/or can find similar method adding overlay mapfragment instead of mapview?

in google maps v2 not called overlay, called polygon. add together 1 map calling googlemap.addpolygon(polygonoptions option) googlemap replaced name of googlemap object. heres info on polyoptions you way add together points, no matter how many points there , makes polygon based on points. or nonbuildings , lines, utilize polylines option

heres googlemap api reference.

hope helps

edit :

drawing circle little bit more intricate since involves anti aliasing , little song , dance.

for convenience found this stackoverflow answer includes code on how done.

android android-fragments overlay google-maps-android-api-2

No comments:

Post a Comment