I have a MapView, with various markers on it. On entering the MapActivity
the first time, I set the bounds of drawables set on the markers, and
everything appears fine. The markers and shadows all appear correctly. But
when I click over to another activity, and return, the shadows, or the
markers are no longer bound correctly. Sometimes its only some of the
markers that are affected. Can anyone tell me what is going on here? Here
is some code. Below is where I set the bounds on the marker drawable:
InputStream is = assetManager.open(imageName);
drawable = Drawable.createFromStream(is, null);
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
drawable.setBounds(-width / 2, -height, width - (width / 2), 0);
And here is how I create/add the overlay item to the map:
GeoPoint point = createGeoPoint(lat, lon);
OverlayItem overlayItem = new OverlayItem(point, character.get_id(),
"");
Drawable image = drawable;
overlayItem.setMarker(image);
itemizedOverlay.addOverlay(overlayItem);
>From what I can tell, the overlays are not being re-added to the map, this
is simply a redraw after an onResume() event. Any ideas?
In addition, only images of the type tapped move, and its not the shadow,
but the image that moves. So, of there are x images of type A, and y images
of type B, and I tap on any image of type A, all images of type A are
misaligned with their shadows when I return to the MapActivity, while all
images of type B are still properly aligned.
This seems to be exclusive to the setMarker() method of setting the image,
as using the default marker does not exhibit this problem.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en