MapView在中间用一个“x”缺失的瓦片渲染。

时间:2020-12-20 08:57:51

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在中间用一个“x”缺失的瓦片渲染。

9 个解决方案

#1


11  

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.

他们在一起出现了,我回顾了发展的开始,他们就在那里,一切都很好。显然,这是MapView中的一个BUG,我猜它同时显示了SateliteView和StreetView。人们会认为后者会推翻前者;但我想没有。

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.

所以,我的问题是,为什么这些突然出现在最近一周左右。我的猜测是,地图应用上一次更新是在9月8日,也许是在更新后的一天左右,这个问题开始重新浮出水面。

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

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

#2


3  

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.

我只有setStreetView(真实的)和得到那些烦人的灰色盒子。我在这两方面都不走运。通过从我的代码中删除setStreeView和setSatellite来解决它,默认情况下进入streetview。

#3


2  

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)...

我的应用程序也有同样的问题使用谷歌地图库…因为在我的设置选项中,用户可以将地图的视图更改为Satelite或Street,所以我不使用setStreetView(true)。只是mapView。setSatelite(真或假)…

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...

你可以看到我有mapView.setStreetView(true),但这让我头疼……我希望这对你有帮助。

#4


2  

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

我从我的代码中删除了setStreetview(true),现在它的工作很好,我在过去的两个星期里看到了这个问题,nyway最终解决了这个问题。

#5


1  

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

Street view一直被认为是默认选项。当我们同时使用setStreetView(true)和setSatellite(true)时,问题就出现了。问题就这样解决了。

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

I hope that will help

我希望这能有所帮助。

#6


1  

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.

mapType是一个用户定义的字符串变量。在切换到视图类型时,不要错误地使用前面的视图类型。我们所犯的错误,只设置您需要的视图类型。

#7


0  

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.

我有同样的问题,我拿出我的mapController,它修好了。我做的另外一件事是用一个textview(它以前只是一个mapview)把mapview放在一个linearlayout中(它只用于mapview),我和mapcontroller一起进行了注释。

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

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

#8


0  

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.

我遇到了同样的问题,我得到的普遍建议是不要使用setStreeView(true)和setSatellite(true)。有些人甚至建议不使用setStreetView(true)。但是我的代码以前工作得很好。我不得不重新安装我的机器,因此在这之后又重新安装了android SDK和其他组件。所以我的猜测是,这是一个特定版本的问题,但我发现这个问题发生在2.2的具体版本中——在我的案例中,Android SDK平台2.2,版本3。我已经尝试过在2.3上运行相同的代码,而且它工作正常。没有灰色的盒子。

#9


0  

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

除了删除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>

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.

请注意在com.google.android.maps.MapView之后的xml命名空间。添加名称空间后,十字块消失。不知道它是否是一个bug或名称空间是必要的,以便api能够正确地呈现地图。无论哪种方式,它工作。

#1


11  

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.

他们在一起出现了,我回顾了发展的开始,他们就在那里,一切都很好。显然,这是MapView中的一个BUG,我猜它同时显示了SateliteView和StreetView。人们会认为后者会推翻前者;但我想没有。

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.

所以,我的问题是,为什么这些突然出现在最近一周左右。我的猜测是,地图应用上一次更新是在9月8日,也许是在更新后的一天左右,这个问题开始重新浮出水面。

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

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

#2


3  

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.

我只有setStreetView(真实的)和得到那些烦人的灰色盒子。我在这两方面都不走运。通过从我的代码中删除setStreeView和setSatellite来解决它,默认情况下进入streetview。

#3


2  

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)...

我的应用程序也有同样的问题使用谷歌地图库…因为在我的设置选项中,用户可以将地图的视图更改为Satelite或Street,所以我不使用setStreetView(true)。只是mapView。setSatelite(真或假)…

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...

你可以看到我有mapView.setStreetView(true),但这让我头疼……我希望这对你有帮助。

#4


2  

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

我从我的代码中删除了setStreetview(true),现在它的工作很好,我在过去的两个星期里看到了这个问题,nyway最终解决了这个问题。

#5


1  

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

Street view一直被认为是默认选项。当我们同时使用setStreetView(true)和setSatellite(true)时,问题就出现了。问题就这样解决了。

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

I hope that will help

我希望这能有所帮助。

#6


1  

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.

mapType是一个用户定义的字符串变量。在切换到视图类型时,不要错误地使用前面的视图类型。我们所犯的错误,只设置您需要的视图类型。

#7


0  

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.

我有同样的问题,我拿出我的mapController,它修好了。我做的另外一件事是用一个textview(它以前只是一个mapview)把mapview放在一个linearlayout中(它只用于mapview),我和mapcontroller一起进行了注释。

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

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

#8


0  

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.

我遇到了同样的问题,我得到的普遍建议是不要使用setStreeView(true)和setSatellite(true)。有些人甚至建议不使用setStreetView(true)。但是我的代码以前工作得很好。我不得不重新安装我的机器,因此在这之后又重新安装了android SDK和其他组件。所以我的猜测是,这是一个特定版本的问题,但我发现这个问题发生在2.2的具体版本中——在我的案例中,Android SDK平台2.2,版本3。我已经尝试过在2.3上运行相同的代码,而且它工作正常。没有灰色的盒子。

#9


0  

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

除了删除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>

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.

请注意在com.google.android.maps.MapView之后的xml命名空间。添加名称空间后,十字块消失。不知道它是否是一个bug或名称空间是必要的,以便api能够正确地呈现地图。无论哪种方式,它工作。