Issue
I have a point of interest being displayed on my mapview
, when it's clicked on, I fire an animateTo
to center it on the screen. However, the annotation that I have popping up after it's clicked on, is sometimes too tall and gets cut off the top of the screen. I want to move the mapview
slightly further down so the entire view will be displayed to the user without them having to move further down.
Solution
This gives you the Latitude value per pixel at the center of the screen at current zoom level:
pixelValueY = projection.fromPixels(mapView.getwidth()/2 ,mapView.getHeight()/2).getLatitudeE6() - projection.fromPixels(mapView.getwidth()/2 ,mapView.getHeight()/2 +1).getLatitudeE6();
Now suppose that you want to move map 20 pixels dowm, you just add the above value to the latitude of original center position:
mapController.animateTo(new GeoPoint(originalCenterLat + 20 * pixelValueY , originalCenterLon));
good luck
Answered By - Luis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.