Android Google Maps resize marker on Zoom

前端 未结 3 1627
没有蜡笔的小新
没有蜡笔的小新 2021-01-21 21:15

I need to display around 30 markers in a somewhat small area.

Is there a way to resize Google Maps API V2 markers when the user changes the zoom?

Or should I jus

3条回答
  •  一生所求
    2021-01-21 21:55

    If you want to do something when zooming, you can create a custom Mapview which extends the original MapView, and just override dispatchDraw(Canvas canvas).

    With adding a little listener, you can do whatever you want in the callback. Something like this;

        @Override
    protected void dispatchDraw(final Canvas canvas) {
        super.dispatchDraw(canvas);
        if (getZoomLevel() != lastZoomLevel) {
            if (listener != null) {
                listener.onZoom(lastZoomLevel, getZoomLevel());
            }
            lastZoomLevel = getZoomLevel();
        }         
    }
    

提交回复
热议问题