简体   繁体   中英

Show text next to marker in Here-Map Android sdk.

I use HereMap on my android app. I am able to plot markers over the map but not able to show text next to markers. Already tried using setTitle and MapLabeledMarker but these do not seem to be working. How can we show some text next to markers plotted on the map in HereMap Android sdk?

The best way to implement this is to use a regular android view layout, inflate it and draw to a bitmap via Canvas APIs. Use the bitmap as the image of the marker as needed.

This provides the best performance as the graphics engine will cache the bitmap you provide and use hardware acceleration to render it.

MapLabeledMarker is working but does not provide enough control on the rendering and sometimes the text is hidden for some reason (over an other marker, a road element, etc.)

I'm adressing this issue by adding two markers, one for the image and one for the text. I'm drawing the text in a bitmap using android.graphics.Paint.

This is probably worse for performance than David Leong solution but it provides a way to hide the text for lower zoom level using the MapObject.setVisibleMask method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM