ItemizedOverlayWithBubble on top of the marker

319 views Asked by At

I want to put my ItemizedOverlayWithBubble by OSMdroid on top of the marker, because now it's on the marker and when it shows my marker hides behind the bubble, because it's the same GeoPoint. What is the correct way?

    final ArrayList<ExtendedOverlayItem> items = new ArrayList<ExtendedOverlayItem>();
    ExtendedOverlayItem a = new ExtendedOverlayItem("Hannover", "SampleDescription", new GeoPoint(42.34105549, -3.69639444), this);
    items.add(0, a);
    ItemizedOverlayWithBubble<ExtendedOverlayItem> mMyLocationOverlay = 
            new ItemizedOverlayWithBubble<ExtendedOverlayItem>
            (this, items, mapView);
    mapView.getOverlays().add(mMyLocationOverlay);

Thanks a lot

2

There are 2 answers

0
marioerro On
a.setMarkerHotspot(OverlayItem.HotspotPlace.TOP_CENTER);

If someone want to know the solution, this is the solution

0
MKer On

Your solution doesn't work fine if the icon design implies a BOTTOM_CENTER hotspot.

There is a known issue about bubble positionning on ExtendedOverlayItem when the default icon is used.

2 solutions:

1) Set an icon to your item: a.setIcon(getResources().getDrawable(R.drawable.my_own_marker));

2) Move to the latest version of OSMBonusPack, v4.2.7, replacing this ItemizedOverlayWithBubble/ExtendedOverlayItem stuff with the Marker API, simpler and similar to the Google Maps V2 one. And also solving this known issue.