Set a max zoom level on LatLngBounds builder

前端 未结 10 629
慢半拍i
慢半拍i 2020-12-13 00:57

I haven\'t found an answer in my search, there are a few answers on SO but they didn\'t work for me.

I have 2 markers on the map and I am using LatLngBounds builder

10条回答
  •  隐瞒了意图╮
    2020-12-13 01:21

    It is just simple:

    LatLngBounds.Builder latlngBuilder = new LatLngBounds.Builder();
    
    LatLng sydney1 = new LatLng(57.149651, -2.099075);
    
    LatLng sydney2 = new LatLng(51.621441, -3.943646);
    
    latlngBuilder.include(sydney1);
    latlngBuilder.include(sydney2);
    
    googlemap.animateCamera(CameraUpdateFactory.newLatLngBounds(latlngBuilder.build(), 100));
    

提交回复
热议问题