Android如何获取我的MapView的屏幕坐标?(可见的矩形)

lac*_*cas 3 android

如何才能保存我的MapView屏幕坐标?(可见的矩形左上角和缩放级别)我想在一段时间后重新加载那些坐标.我怎样才能做到这一点?

谢谢,莱斯利

Ros*_*tev 6

我不知道你是否找到了问题的答案,所以我会告诉你我的解决方案.我把以下代码放在MapView类的子类中.

    GeoPoint topLeft = this.getProjection().fromPixels(getLeft(), getTop());
    GeoPoint bottomRight = this.getProjection().fromPixels(getRight(), getBottom());
    int topLat = topLeft.getLatitudeE6();
    int topLng = topLeft.getLongitudeE6();
    int bottomLat = bottomRight.getLatitudeE6();
    int bottomLng = bottomRight.getLongitudeE6();
Run Code Online (Sandbox Code Playgroud)

我希望它会对你有所帮助.