For everyone who has the same problem as me, the solution is actually quite simple.
All you have to do is set the borders to OverlayItem drawable, for example:
Drawable d = myOverlayItem.getMarker(0);
d.setBounds(-xWidth/2, -yWidth/2, xWidth, yWidth);
The parameter for getMarker actually depends on the state of overlayItem, but for me personally it is the same for all my states, so I didn’t care and just used 0.
I'm not sure how the solution will change depending on where you actually set the borders, but for me I did this in the draw method of my subclass of ItemizedOverlay:
@Override
public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow) {
if (!shadow) {
for (int i = 0; i < mOverlays.size(); i++) {
Drawable d = mOverlays.get(i).getMarker(0);
d.setBounds(-width/2, -height/2, width/2, height/2);
}
}
super.draw(canvas, mapView, shadow);
}
, overlay 0,0, , OverlayIcon. , 50 50, OverlayItem ( OverlayItem). Overlay:
protected static void drawAt(Canvas canvas, Drawable drawable, int x, int y, boolean shadow)
{
canvas.save();
canvas.translate(x, y);
drawable.draw(canvas);
canvas.restore();
}
( canvas.translate)
, - Overlay.
( maps.jar, ).