0


As in above images ,marker always visible even if zoom out completely and all marker are getting attach together completely when zoom out

So how to adjust maker size while zoom in and zoom out as in below images

Jubin Justifies
  • 397
  • 4
  • 12
kam1234
  • 574
  • 2
  • 5
  • 9

1 Answers1

0

If you need to change the markers size according to zoom out and in, then need to implement onCameraMove() listener and according to zoom level you need to change the icon of marker added as below

override fun onCameraMove() {
 var zoomlevel = map.cameraPosition.zoom
        if (zoomlevel < 6) {
            marker1?.apply {
                setIcon(BitmapDescriptorFactory.fromResource(R.drawable.car_yellow_xs))
            }
        }
        else if (zoomlevel <= 10) {
            marker1?.apply {
                setIcon(BitmapDescriptorFactory.fromResource(R.drawable.car_yellow_small))
            }
        }
        else if (zoomlevel <= 12) {
            marker1?.apply {
                setIcon(BitmapDescriptorFactory.fromResource(R.drawable.car_yellow_med_small))
            }
        }
}

Make sure marker images size should be increased with increasing zoom level, Hence you need to change images of marker according to the zoom level in camera move listener. Let me know if this works!

Bhoomi
  • 172
  • 1
  • 9
  • sir can we use same icon instead of using three different icon and resize it while zoom in and zoom out if so then please provide me that code – kam1234 Oct 03 '19 at 11:49
  • We can't use same icon, you need to resize the icons according to zoom level with different image sizes then only you can see proper images will zoom out or in. – Bhoomi Oct 04 '19 at 12:53
  • You can check these two links if it works: 1> https://stackoverflow.com/a/15685465/5786187 2> https://stackoverflow.com/a/3520062/5786187 – Bhoomi Oct 07 '19 at 07:28