2010-07-31 90 views
6

可能重复:
How can I determine if a geopoint is displayed in currently viewable area?获取的地图范围使用Android的谷歌地图

我想知道是否有任何方式(我有点在Java中的新手),以获得MapBounds Android上的Google MapView。

只是为了澄清,这是我想要做的。

无论何时移动地图,或放大并在Toast中显示这些值,计算最大值和最小值。

是否有任何可能的方法来做到这一点 - 或者我在我的头上?

+0

它不重复。 – 2012-12-02 22:33:36

回答

13

你应该能够结合使用

mapView.getLatitudeSpan(); 
mapView.getLongitudeSpan(); 

mapView.getMapCenter(); 

弄清楚可见区域。

但我注意到一些用户有问题。

Mapview getLatitudeSpan and getLongitudeSpan not working

您应该检查Android开发者群体,以及可能。

+0

谢谢,通过这两个命令以及我从locationManager服务获得的观点,事情工作得很好。 – hwrdprkns 2010-08-11 16:58:24

+0

这个答案给出了我在阅读你之后缺少的线索:http://stackoverflow.com/questions/3413194/how-to-load-markers-dynamically-for-current-position-in-android-google-maps/3413311 #3413311 – Maragues 2011-05-10 16:45:16

+1

mapView.getMapCenter()而不是getCenter() – 2012-05-11 13:09:29