平局正在不断呼吁在我的Android地图叠加 [英] draw is being constantly called in my android map overlay
问题描述
我想画一个路线到我的图形页面。 我一直延伸覆盖和实现的draw()方法。 这条路线是正确显示,虽然在调试, 我加的平局()断点,发现它被称为不断。
I'm trying to draw a route onto my MapView. I've extended Overlay and implemented the draw() method. The route is displayed properly, although while debugging, I added a breakpoint on draw(), and noticed it is being called constantly.
我只希望它被重新绘制,如果有人移动地图或缩放(绘制路线抽签时考虑到这些变化) 是什么原因?
I only want it to be re-drawn if someone moves the map or zooms (the draw take into account these changes when drawing the route) What can cause this ?
推荐答案
有可以覆盖两队战平的方法。
There are two draw methods that can be overridden.
void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow)
说明:绘制叠加在地图
Desc: Draw the overlay over the map.
布尔平局(android.graphics.Canvas帆布,图形页面图形页面,布尔影子,时长)
说明:绘制呼吁动画叠加
boolean draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow, long when)
Desc: Draw call for animated overlays.
我本来overrided第二个。
改变为第一方法后,它的工作
I originally overrided the second one.
After changing to the first method, it worked out.
这篇关于平局正在不断呼吁在我的Android地图叠加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!