我有一个兴趣点显示在我的mapview上,当它被点击时,我触发一个animateTo使它在屏幕上居中。然而,我在点击后弹出的注释,有时太高了,会从屏幕顶部被切掉。我希望将mapview稍微向下移动,以便向用户显示整个视图,而不必进一步向下移动。
发布于 2012-09-29 00:40:36
这将为您提供当前缩放级别下屏幕中心的每个像素的纬度值:
pixelValueY = projection.fromPixels(mapView.getwidth()/2 ,mapView.getHeight()/2).getLatitudeE6() - projection.fromPixels(mapView.getwidth()/2 ,mapView.getHeight()/2 +1).getLatitudeE6();现在假设您想要将地图向下移动20个像素,您只需将上面的值添加到原始中心位置的纬度:
mapController.animateTo(new GeoPoint(originalCenterLat + 20 * pixelValueY , originalCenterLon));祝好运
https://stackoverflow.com/questions/12642611
复制相似问题