Android的图形页面平移和缩放速度太慢 [英] Android Mapview panning and zooming too slow

查看:327
本文介绍了Android的图形页面平移和缩放速度太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了 GPS 应用程序中,我记录用户根和表现出来 在地图上.......但 当回顾我的路线是痛苦的缓慢平移周围的地图上, 它至少需要4或5秒钟的地图响应手指 刷卡......

I've developed a GPS app in which i record the user roots and show it on the map.......but Panning around on the map when reviewing my route is painfully slow, it takes at least 4 or 5 seconds for the map to respond the finger swipes......

我已经覆盖了的OnDraw()方法和绘制线条展现 路线......有没有更好的办法做到这一点,使声像变 快如MyTracks ...........

I've overridden the onDraw() method and drawing the lines to show the routes......is there any better way to do this so that panning becomes faster as in "MyTracks"...........

感谢大家..... 普拉塔普S.

Thank you all..... Pratap S.

推荐答案

注释从五月dalelane的回答,7: 我用你的解决方案,以减少绘制的载荷,但修改了一点:

Comment to dalelane's answer from May,7th: I used your solution for reducing the load of drawing, but modified it a bit:

  • 创建一个新的位图,如果地图中心,变焦levelhave cjanged或没有旧的位图存在。

缩放路由后放置在正确的位置。看来,缩放还没有完全完成,改变的缩放级别被检测到时。

After zooming the route is placed on the correct position. It seems that zooming has not finished completely, when a changed zoom level is detected.

我用了一个定时器,它修改了10地图中心的600毫秒改变缩放级别后延迟一段时间后。 通过改变地图中心的抽签方法被调用,并创建一个新的位图。路线然后放置正确。  这是一个丑陋的变通。有没有人更好的解决方案?

I used a timer, which modifies the map center by 10 after a delay of 600 msecs after the zoom level changed. By changing the map center the draw method is called and creates a new bitmap. The route then is placed correctly. This is an ugly work around. Has anyone a better solution?

private void panAfterZoom(MapView mv, long delay){
    timer = new java.util.Timer("drawtimer", true);
    mapView=mv;
    task = new java.util.TimerTask() {
       public void run() {
           GeoPoint center=mapView.getMapCenter();
           GeoPoint point=new GeoPoint(center.getLatitudeE6()+10, center.getLongitudeE6());
           MapController contr=mapView.getController();
           contr.setCenter(point);
           timer.cancel();
       }
       };
    timer.schedule(task, delay);
}

这是所谓的抽奖方法:pabAfterZoom(图形页面,600);

This is called in the draw method as: pabAfterZoom(mapView, 600);

博斯特

这篇关于Android的图形页面平移和缩放速度太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆