2010-07-31 91 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