“使用newLatLngBounds(LatLngBounds,int)的错误”错误

问题描述 投票:0回答:1

[当我尝试使用bound对googleMap.moveCamera进行操作时,出现错误Error using newLatLngBounds(LatLngBounds, int)。我该如何解决?

android
1个回答
0
投票

改为使用newLatLngBounds(LatLngBounds, int, int, int)。它告诉布局的newLatLngBoudnd()宽度和高度。就我而言:

...
int width = getResources().getDisplayMetrics().widthPixels;
int height = getResources().getDisplayMetrics().heightPixels;
int padding = 50;

mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, width, height, padding));
...

Ref:https://github.com/googlemaps/android-samples/issues/10

© www.soinside.com 2019 - 2024. All rights reserved.