1

我想为每个缩放级别更新我在地图视图上绘制的多边形。放大或缩小地图视图时如何获得通知?

BR

4

1 回答 1

3

不幸的是,没有通知您缩放级别更改的本机回调。您可以做的是扩展本机地图视图并在onDraw方法内查找缩放级别更改:

public final class CustomMapView extends MapView
{
    private int lastZoomLevel = -1;


    @Override
    public void draw(Canvas canvas) 
    {
        if (isZoomChange()) 
        {
            lastZoomLevel = this.getZoomLevel();
            onZoomLevelChange(lastZoomLevel); //this would be your notification function
        }
        super.draw(canvas);
    }

    private boolean isZoomChange() 
    {
        return (getZoomLevel() != lastZoomLevel);
    }
}
于 2012-09-24T20:32:26.017 回答