Search code examples
androidzoomingandroid-mapviewgoogle-maps-markers

Scale Map Markers by Zoom, Android


I have lot of markers on my map. Zooming in each marker shows me a position. but zooming out the markers are overlapping each other and it is more difficult do determine the position of a marker.

Is there a way to scale the marker image depending on the zoom factor?


Solution

  • Depends on how you draw your marker. If your marker is just a bitmap/drawable, simply use matrix.postScale()

    Matrix matrix = new Matrix();
    matrix.postScale(2f, 2f); // douple the size
    canvas.drawBitmap(mBitmap, matrix, mPaint);