开发者

Does Google Maps have an onZoomLevelChange() or similar?

开发者 https://www.devze.com 2023-02-27 04:55 出处:网络
I want to place different drawables on the map depending on the zoom level. Can this be done? IS there a way to detect zo开发者_运维技巧om change when it happens?

I want to place different drawables on the map depending on the zoom level. Can this be done? IS there a way to detect zo开发者_运维技巧om change when it happens?

Android App


If you are using the Maps API you can just call the "getZoomLevel()" on the MapView.

 int    getMaxZoomLevel() 
          Returns the maximum zoom level for the point currently at the center.
 int    getZoomLevel() 
          Returns the current zoom level of the map

The easiest way to handle it would be overwrite the "OnTouchEvent" to check and dispatch a background task associated with the zoom level.

boolean onTouchEvent(android.view.MotionEvent ev) 
          Passes trackball events to the overlays first, and if they don't handle them, feed it to a gesture detector, and dispatch the detected gestures

make sure you supply "super.OnTouchEvent" if you don't do anything special with it.

0

精彩评论

暂无评论...
验证码 换一张
取 消