我正在尝试获取我的地图视图的范围,但我遇到的问题是纬度始终设置为 0,而经度始终设置为 360*1E6。根据这个链接,那是因为它只会在地图完全加载时提供正确的坐标: Mapview getLatitudeSpan and getLongitudeSpan not working
现在,我对解决方案完全感到困惑,我做了这个方法,我从我的 mainactivity (地图视图)的 onCreate 调用:
public int[][] getBounds()
{
GeoPoint center = this.mapView.getMapCenter();
int latitudeSpan = this.mapView.getLatitudeSpan();
int longtitudeSpan = this.mapView.getLongitudeSpan();
int[][] bounds = new int[2][2];
bounds[0][0] = center.getLatitudeE6() + (latitudeSpan/2);
bounds[0][1] = center.getLongitudeE6() + (longtitudeSpan/2);
bounds[1][0] = center.getLatitudeE6() - (latitudeSpan/2);
bounds[1][1] = center.getLongitudeE6() - (longtitudeSpan/2);
return bounds;
}
如何让这个等待地图视图加载?我已经查看了 postDelayed 的 API,但我无法让它工作。
如果我是愚蠢的,请原谅我