android Google Map v2上的适合所有缩放比例的标记 [英] android Zoom-to-Fit All Markers on Google Map v2

查看:102
本文介绍了android Google Map v2上的适合所有缩放比例的标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以覆盖所有标记的方式放大/缩小地图视图?

我正在审查sdk中提供的gmap V2的示例代码.它位于sdk \ extras \ google \ google_play_services \ samples \ maps上.

谢谢.

解决方案

尝试使用LatLngBounds:

LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(Latlng1);
builder.include(Latlng2);
LatLngBounds bounds = builder.build();
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20));

How to zoom in/out the map view such a way that it cover all markers?

i am reviewing sample code of gmap V2 given in sdk. It lays on sdk\extras\google\google_play_services\samples\maps.

Thanks in advance.

解决方案

Try using LatLngBounds :

LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(Latlng1);
builder.include(Latlng2);
LatLngBounds bounds = builder.build();
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20));

这篇关于android Google Map v2上的适合所有缩放比例的标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆