java - How to create an information bubble on a map (not google api) -
in android application have custom view functions map. when user touches particular location, able display more information in sort of information bubble. similar how google maps api works, not want use api.
so far have tried drawing rounded rectangle directly canvas , drawing text on top @ specified location. has considerable drawbacks:
1) don't know how calculate how big rectangle should relative length , size of text.
2) drawing rectangle leaves no room power of views (with built in ontouch events, , room customize view)
i have tried using view (button) display information have had no success. far know, cannot specify coordinates view should display (since information bubble needs move according map scrolled).
in summary, need best of both methods image should resize according amount of text displayed, , information bubble should able move around screen according map scrolled.
does have suggestions on best approach create information bubble without using google maps api?
i no way 100% sure proposed method correct way, how go problem:
you first need calculate size of text before calculate size of box in, this, use following methods, providing have created paint object use draw text.
//this give width of text textpaint.measuretext("text render") //this give height of text textpaint.getfontspacing()
in terms of drawing map , information bubble, how it:
your whole map image base box, , part in view view box. so, if user pans , zooms on map, happening using our view box display part of map. tricky work out draw bubble in terms of view box, if make relative base box, becomes pretty easy. draw entire map, including bubble, , crop part in view.
this purely how go it, think not hard implement. need keep track of how view box has been offset top left corner of base box , can pretty pick in relation base box bubble needs planted.
let me know if did not explain well.
best,
ignus
Comments
Post a Comment