MapView 渲染中缺少“x”的图块在中心

发布于 2024-12-05 13:26:41 字数 203 浏览 1 评论 0原文

这非常非常奇怪。我从来没有见过这样的事情。当我拍摄此屏幕截图时,我没有加载任何叠加层。首先,我以为是我的网络连接导致无法下载磁贴信息;但我们有很多从市场下载的用户报告了同样的问题。这件事大约一周前才开始发生。但不知道为什么。有人知道吗?谢谢!


缺少图块的地图视图

This is very, very strange. I've never seen anything like it. At the time I am took this screenshot, I'm not loading any overlays. First, I thought it was my internet connection where it couldn't download the tile information; but we have many users reporting the same issue who downloaded from the market. This just started happening like a week ago. Not sure why though. Anyone have a clue? Thanks!


mapview with tiles missing

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

も星光 2024-12-12 13:26:41

好的。从一个干净的项目开始后,我发现这两行代码是罪魁祸首。

mapView.setSatellite(true);

mapView.setStreetView(true);

他们背靠背地出现,我回顾了开发的一开始,他们就在那里,而且工作得很好。显然,这是 MapView 中的一个 BUG,因为我猜测它会尝试同时显示 SateliteView 和 StreetView。人们会认为后者会凌驾于前者之上;但我想不是。

所以,我的问题是,为什么在上周左右突然出现这种情况。我的猜测是,地图应用程序最后一次在市场上更新是在 9 月 8 日,也许在市场更新后一天左右,这个问题开始重新出现。

作为测试,有人可以将这两行添加到他们的代码中并确认您得到相同的行为吗?

Ok. After starting from a clean project I found these two lines of code that was the culprit.

mapView.setSatellite(true);

mapView.setStreetView(true);

They appeared back to back of each other and I looked back at the very beginning of development and they were there and it worked just fine. Apparently, this is a BUG in the MapView as I'm guessing it tries to show both SateliteView and StreetView at the same time. One would think that the latter would override the former; but I guess not.

So, the question I have is, why this all of the sudden surfaced just within the last week or so. My guess is that the Maps Application was last updated in the market on Sept 8th and maybe a day or so after updating from the market, this issue started to resurface.

As a test, can someone just add these two lines to their code and confirm you get the same behavior?

逆蝶 2024-12-12 13:26:41

我只有 setStreetView(true) 并得到那些烦人的灰色框。我尝试了这两条线但没有运气。通过从我的代码中删除 setStreeView 和 setSatellite 解决了这个问题,默认情况下转到街景。

I had only setStreetView(true) and getting those annoying grey boxes. I played around with both lines with no luck. Solved it by removing both setStreeView and setSatellite from my code, goes to streetview by default.

远昼 2024-12-12 13:26:41

我使用谷歌地图库的应用程序遇到了同样的问题...因为我在我的设置选项中用户可以将地图视图更改为卫星或街道,所以我根本不使用 setStreetView(true)...只是 mapView .setSatelite(true or false)...

preferences = PreferenceManager.getDefaultSharedPreferences(this);
        pogled = preferences.getString("list", "Street");

        if(pogled.equalsIgnoreCase("Street")){
            mapView.setSatellite(false);
            //mapView.setStreetView(true);
        }else if (pogled.equalsIgnoreCase("Satelite")) {
            mapView.setSatellite(true);
        }

正如你所看到的,我有mapView.setStreetView(true),但这让我很头痛...:DI希望这会帮助你...

I had the same problem with my app that uses google maps library... Because i have in my setting option where user can change view of the map to Satelite or Street, i dont use setStreetView(true) at all...just mapView.setSatelite(true or false)...

preferences = PreferenceManager.getDefaultSharedPreferences(this);
        pogled = preferences.getString("list", "Street");

        if(pogled.equalsIgnoreCase("Street")){
            mapView.setSatellite(false);
            //mapView.setStreetView(true);
        }else if (pogled.equalsIgnoreCase("Satelite")) {
            mapView.setSatellite(true);
        }

As you can see i had mapView.setStreetView(true) but that gave me a headache... :D I hope this will help you...

雄赳赳气昂昂 2024-12-12 13:26:41

我从代码中删除了 setStreetview(true) ,现在它工作正常,我看到这个问题在过去两周内发生,无论如何我们终于解决了这个问题,这太棒了

I removed setStreetview(true) from my code and now its working fine i was saw this issue occured in last 2 weeks , nyway we finally solved the issue thats great

别靠近我心 2024-12-12 13:26:41

街景始终被视为默认选项。
当我们同时使用 setStreetView(true) 和 setSatellite(true) 时,就会出现问题。问题将这样解决

    if(mapView.isSatellite()){
        mapView.setSatellite(false);
            }else{
            mapView.setStreetView(false);
            mapView.setSatellite(true);
            }

我希望这会有所帮助

Street view is always considered as the default option.
The problem arises when we use both setStreetView(true) and setSatellite(true) at the same time. Problem will be solved like this

    if(mapView.isSatellite()){
        mapView.setSatellite(false);
            }else{
            mapView.setStreetView(false);
            mapView.setSatellite(true);
            }

I hope that will help

☆獨立☆ 2024-12-12 13:26:41
private void setUpMapTypeScreen() {
    if (mapType.equalsIgnoreCase("Satellite")) {
        mapView.setSatellite(true);
        // mapView.setStreetView(false);
    } else if (mapType.equalsIgnoreCase("StreetView")) {
        mapView.setSatellite(false);
        // mapView.setStreetView(true);
    }
    mapView.invalidate();
}

mapType 是用户定义的字符串变量。切换到视图类型时,不返回之前的视图类型。我们犯的错误,只设置了你需要的视图类型。

private void setUpMapTypeScreen() {
    if (mapType.equalsIgnoreCase("Satellite")) {
        mapView.setSatellite(true);
        // mapView.setStreetView(false);
    } else if (mapType.equalsIgnoreCase("StreetView")) {
        mapView.setSatellite(false);
        // mapView.setStreetView(true);
    }
    mapView.invalidate();
}

mapType is a user defined string variable. Not false the previous view type when switching to view types. that the error we made, only set the view type you required.

执笔绘流年 2024-12-12 13:26:41

我遇到了同样的问题,我拿出了我的mapController,它解决了它。我做的唯一不同的事情是将地图视图放在带有文本视图的线性布局中(它过去只是一个地图视图),然后我使用地图控制器,将其注释掉。

由于这是我改变的唯一两件事,我很确定你的问题也在那里。

I had the same problem, I took out my mapController, and it fixed it. The only other thing I did different was put the mapview in a linearlayout with a textview (it used to just be a mapview only) and I played around with the mapcontroller, commenting it out.

Since those are the only two things I changed, I'm pretty sure your problem lies in there as well.

苍景流年 2024-12-12 13:26:41

我遇到了同样的问题,我得到的常见建议是不要一起使用 setStreeView(true) 和 setSatellite(true) 。有些人甚至建议不要完全使用 setStreetView(true) 。但我的代码之前工作正常。我不得不重新安装我的机器,因此重新安装了 android SDK 和其他组件,然后这种情况开始发生。所以我的猜测是这是某个特定版本的问题但我发现这个问题发生在 2.2 的特定修订版上 - 在我的例子中是 Android SDK Platform 2.2,修订版 3。我尝试在 2.3 上运行相同的代码并且它可以正常工作即没有灰色框。

I was having the same problem and the common advice that I have got is to not use setStreeView(true) and setSatellite(true) together. Some have even suggested not to use setStreetView(true) altogether. But my code was working okay before. I had to reinstall my machine and therefore installed android SDK and other components afresh after which this started happening. So my guess is that this is an issue with some specific version But I have found out that this problem occurs specific revision of 2.2 - in my case Android SDK Platform 2.2, revision 3. I have tried running same code on 2.3 and it works correctly i.e no grey boxes.

佞臣 2024-12-12 13:26:41

除了删除mapController.setStreetView(true)之外,还应该添加另一件事到布局XML中。

xmlns:android="http://schemas.android.com/apk/res/android"

<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapa" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:apiKey="YOUR API KEY"
    android:clickable="true"></com.google.android.maps.MapView>

注意com.google.android.maps.MapView后面的xml命名空间。添加命名空间后,十字图块消失了。不知道这是一个错误还是需要命名空间才能使 api 正确渲染地图。不管怎样,它奏效了。

Besides removing mapController.setStreetView(true), there is also another thing that should be added to the layout XML..

xmlns:android="http://schemas.android.com/apk/res/android"

<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapa" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:apiKey="YOUR API KEY"
    android:clickable="true"></com.google.android.maps.MapView>

Note the xml namespace after com.google.android.maps.MapView. After adding the namespace, the cross tiles disappeared. Don't know if it's a bug or the namespace is necessary in order for the api render the map correctly. Either way, it worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文