Android Google Maps api v2停止加载图块 [英] Android Google Maps api v2 stops loading tiles

查看:217
本文介绍了Android Google Maps api v2停止加载图块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在加载片段时,它会加载初始图块.之后,随着地图根据GPS位置移动,它会自动停止加载更详细的图块.如果我滑动地图,它将加载所有其他图块.在某个时候,我将超过它已加载图块的位置,并且我将不得不轻扫屏幕以下载更详细的图块.我已将android:heapLarge ="true"添加到清单中,但这不能解决问题. http://i60.tinypic.com/rr8sd1.png

Upon loading the fragment it loads initial tiles. After that, it stops loading more detailed tiles automatically as the map moves according to GPS position. If I swipe the map it'll load all additional tiles. At some point I'll get past the point where it had loaded tiles and I'll have to swipe the screen to download more detailed tiles. I've added android:heapLarge="true" to the manifest, but that doesn't solve the issue. http://i60.tinypic.com/rr8sd1.png

我已经弄清楚了为什么会这样.我将动画时间设置为1秒以使其平滑.这不允许地图停止,这是更新和加载新图块所必需的.自将其更改为900毫秒以来,地图停止了十分之一秒,并加载了必要的图块.

I've figured out why this was happening. I had set the animation time to 1 second to smooth it out. This doesn't allow the map to stop, which is required in order to update and load new tiles. Since I've changed it to 900 ms the map stops for a tenth of a second and loads the necessary tiles.

推荐答案

我以前在另一个问题中没有看到过这个问题,今天却找不到该问题:(解决方案您必须让地图呼吸,可以这么说.意思是您可以不会连续移动地图.由于地图交互是在UI线程上完成的,所以发生的事情是UI线程被阻塞了,实际上所有UI都将在您的应用程序中停止工作.

I've seen this before in another question can't find that question today :( Solution You have to let the map breathe so to speak. Meaning you can't do continuous moves of the map. Because the map interaction is done on the UI thread what happens is the UI thread gets clogged and actually everything UI will stop working in your app.

下面的代码每N秒发送一次更新,并使用动画移动地图.挺不错的,挺不错的.只需将类复制到您的项目中,然后开始移动地图.

The code below sends updates every N seconds and moves the map with an animation. It's nice has a non jerk move to it. Simply copy the class to your project and start moving the map.

https://github.com/danny117/MapMover

这篇关于Android Google Maps api v2停止加载图块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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