1

I have HERE map on my android application. I want to plot markers over the map with some text ( e.g. marker identity name ). TEXT should be placed next to marker image icon preferably right side of icon.

Option Tried :

  1. Marker marker.setTitle : It only sets title for infobox, TEXT doesn't appear always with icon as required.
  2. MapLabeledMarker : Unable to use this with map cluster. What i found is, you can add marker object to map cluster but not MapLabeledMarker.

I'm using 90-days trail HERE Map premium Android SDK. Thanks.

Shashi Bhushan
  • 1,292
  • 11
  • 15

2 Answers2

0

Not ideal or efficient but it may be sufficient based on your use case to create a Bitmap from an Android layout which represents what you want: https://stackoverflow.com/a/8120310/275524. You can then create the HERE SDK Image from this Bitmap.

AndrewJC
  • 1,318
  • 12
  • 11
  • thanks for your reply. but it is not efficient as you mentioned and more worse in my case because I am dealing with more than 3K markers on Map. – Shashi Bhushan Jun 21 '17 at 02:38
0

I Think this snippet will solve your problem.

Create a new layout Programatically like this:

TextView textView = new TextView(context);
textView.setTextColor(Color.parseColor("#FFFFFF"));
textView.setText("Centered ViewPin");

LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setBackgroundResource(R.color.colorAccent);
linearLayout.setPadding(10, 10, 10, 10);
linearLayout.addView(textView);

Add Mapoverlay on it:

MapOverlay mapOverlay = new MapOverlay(view, marker.getCoordinate());
 //dp to pixel
    int paddingX = (10);
    int paddingY = (10);

PointF pointF = new PointF(marker.getAnchorPoint().x + paddingX, 
marker.getAnchorPoint().y + paddingY);
mapOverlay.setAnchorPoint(pointF);
map.addMapOverlay(mapOverlay);