我正在尝试在onClusterClick
之后实现缩放,但我正在使用此库Link而我不知道如何操作。在谷歌图书馆
@Override
public boolean onClusterClick(final Cluster<MyItem> cluster) {
map.animateCamera(CameraUpdateFactory.newLatLngZoom(
cluster.getPosition(), (float) Math.floor(map
.getCameraPosition().zoom + 1)), 300,null);
return true;`
但我没有getPosition()
。我只有getLatitude()
和getLongitude
答案 0 :(得分:1)
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(getLatitude(), getLongitude()), MY_ZOOM)
或者这个选项
LatLngBounds.Builder builder = LatLngBounds.builder();
for (SampleClusterItem item : cluster.getItems()) {
builder.include(new LatLng(item.getLatitude(), item.getLongitude()));
}
final LatLngBounds bounds = builder.build();
try {
mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, PADDING));
} catch (Exception e) {
Log.e("TAG_SNAP", "onClusterClick: " + e.getMessage());
}