zoomToSpan实现问题问题、zoomToSpan

由网友(涼城美景不敵妳-/°)分享简介:我使用谷歌地图在android系统,其中我对map.In填充不同的标记的平均时间,我在执行缩放级别覆盖在地图上的所有标记困难。I am using Google map in android where I am populating different markers on the map.In the mean...

我使用谷歌地图在android系统,其中我对map.In填充不同的标记的平均时间,我在执行缩放级别覆盖在地图上的所有标记困难。

I am using Google map in android where I am populating different markers on the map.In the mean time I am difficulty in implementing the zoom level which cover all the markers on the map.

谁能告诉我在android系统实施zoomToSpan的正确方法。

Can anyone tell me the right way of implementing the zoomToSpan in android.

推荐答案

您需要跟踪所有标记的​​位置,以确定正确的边界:

You need to track the positions of all the markers to determine the proper bounds:

初始化4个整数:与Integer.MIN_VALUE的,底部的顶部和右侧边界和界限左为Integer.MAX_VALUE 。遍历所有的标记的位置和更新适当的范围:左边应该是最小的纬度,对最大的纬度,底部最小的经度,顶部最大纬度(所有这些使用纬度E6值)通zoomToSpan右侧和左侧和顶部和底部之间的差异之间的差别,你应该是好的。

您可能需要做一些额外的工作,以妥善管理为中心的地图,使一切都在看,而是做应该。

You may need to do some extra work to manage centering the map properly so everything is in view, but that should about do it.

阅读全文

相关推荐

最新文章