I have an Android app with a MapView, and zoom controls have been implemented. But I want to detect when the zoom level has changed, so I can do certain things when that happens. Is ther开发者_开发问答e any listener to do that? Any example?
With a little bit of research, I found this site:
http://pa.rezendi.com/2010/03/responding-to-zooms-and-pans-in.html
Specifically, this code:
int oldZoomLevel=-1;
public void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (getZoomLevel() != oldZoomLevel) {
//do your thing
oldZoomLevel = getZoomLevel();
}
}
Would seem to do more or less what you want.
Edit:
In other words, you can solve this by subclassing the mapview, and override the dispatchDraw.
精彩评论