How can I scale marker size in android google maps fragment, when zoom on map changes.
Get same effect like uber has with cars.

Scale marker size on google map
1.8k Views Asked by pepela At
2
There are 2 best solutions below
0
On
if marker is a bitmap image we can change its width and height using
Bitmap.createScaledBitmap(bitmapDp, width, hight, false); we need to call this from onCameraMove() call back.
for (int k = 0; k < markers.size(); k++) {
resizedBitmap(bitmapArrayList.get(k), 250, 250);
markers.get(k).setIcon(BitmapDescriptorFactory.fromBitmap(resizedBitmap));
}
public Bitmap resizedBitmap(Bitmap bitmapDp, int width, int hight) {
resizedBitmap = Bitmap.createScaledBitmap(bitmapDp, width, hight, false);
return resizedBitmap;
}
Here is a method to create marker based on sizes:
Then you must add
TouchOverlyto map by calling :Where the
TouchOverlyis:And finally refresh markers on map in
onZoom: