Center a map marker in Android

前端 未结 3 403
甜味超标
甜味超标 2021-01-11 12:23

I use the following code to display a single marker at a zoom level but it doesn\'t center tha marker on the map. Only one marker will ever be shown:

LatLng          


        
3条回答
  •  南方客
    南方客 (楼主)
    2021-01-11 13:02

    this is because you need to move you camera to the CameraUpdateFactory you created, like this:

    LatLng latLng = new LatLng(Latitude, Longitude);
    map.animateCamera(CameraUpdateFactory.newLatLng(latLng, 11);
    

    if you don't want the animation, then you could just use:

    map.moveCamera(CameraUpdateFactory.newLatLng(latLng, 11);
    

提交回复
热议问题