问题
I am trying to show the custom layout when user clicks on the marker object. The basic pack code works properly .
However when i shifted to premium pack it does not have Map.InfoBubbleAdapter(),hideInfoBubble,getInfoBubbleContents and isInfoBubbleVisible.
I am not even able to open the infoBubble when user click on marker too.
This is the code for custom view in basic pack i used.
hereMap.get(new Map.InfoBubbleAdapter() {
@Override
public View getInfoBubbleContents(MapMarker mapMarker2) {
return null;
}
@Override
public View getInfoBubble(MapMarker mapMarker2) {
View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_marker_infowindow, null);
TextView infoWindowText = view.findViewById(R.id.infoMessage);
infoWindowText.setText(mapMarker2.getTitle());
return view;
}
});
and this is the code that i was using on click of marker
@Override
public boolean onMapObjectsSelected(List<ViewObject> objects) {
for (ViewObject object : objects) {
if (object.getBaseType() == ViewObject.Type.USER_OBJECT && ((MapObject) object).getType() == MapObject.Type.MARKER) {
MapMarker mapMarker = (MapMarker) object;
System.out.println("Title is................." + mapMarker.getTitle());
if (!mapMarker.isInfoBubbleVisible()) {
mapMarker.getInfoBubbleContents();
} else {
mapMarker.hideInfoBubble();
}
return true;
}
}
How can i show the custom info bubble when user click on the marker?
回答1:
You should use sticky map overlays instead: https://developer.here.com/documentation/android-premium/api_reference_java/com/here/android/mpa/mapping/MapOverlay.html
Then add your MapOverlay implementation to the Map via Map.addMapOverlay: https://developer.here.com/documentation/android-premium/api_reference_java/com/here/android/mpa/mapping/Map.html#addMapOverlay-com.here.android.mpa.mapping.MapOverlay-
The idea behind is, that you can use a normal Views (very flexible, your own design, etc.) and stick it to a position on the map (and the map will keep it in place then). This gives you full flexibility on logic and design.
来源:https://stackoverflow.com/questions/53409090/here-map-premium-plan-map-infobubbleadapter-hideinfobubble-getinfobubblecont