在TabActivity多地图V2地图、TabActivity

2023-09-05 06:52:23 作者:深海时光和你

我目前正试图在利用图形页面对象TabActivity不同的选项卡2的地图V2。在下列情况下,问题出现了:

I'm currently trying to have 2 maps v2 in different tabs of a TabActivity using MapView objects. The problem arises in the following scenario:

在显示TAB1与地图 去TAB2,以显示另一个地图 在第二个选项卡看起来像第一个选项卡中的地图图像重叠的新的地图。参见下图:

在你可以看到第一张图仍显示在其上的权利。触摸事件,是要在新的地图,但是这并没有真正的帮助。我花了很多时间试图转换我们的应用程序使用碎片和遇到其他类型的问题。其中之一是http://$c$c.google.com/p/android/issues/detail?id=40035所以这不是一个很好的选择,无论是。

On the right you can see how the first map is still displayed on top of it. The touch events are going to the new map but that doesn't really help. I spent a lot of time trying to convert our app to use fragments and run into other types of issues. One of them being http://code.google.com/p/android/issues/detail?id=40035 so that's not a good option either.

到目前为止,我一直没能找到任何解决办法。要轻易尝试各种变化我写了一个简单的应用程序,并使其可在这里: https://github.com/cristizmf/TestMapsV2 。它映射库项目,并在明显的一个很好的地图密钥只需要在正确的位置。

So far I haven't been able to find any workaround. To easily try various changes I wrote a simple application and made it available here: https://github.com/cristizmf/TestMapsV2. It needs only the right location for maps library project and a good maps key in manifest.

任何想法将大大AP preciated。

Any ideas would be greatly appreciated.

后来编辑:我登录的一个问题是:https://$c$c.google.com/p/gmaps-api-issues/issues/detail?id=5027&thanks=5027&ts=1362071369

Later edit: I've logged an issue for this: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5027&thanks=5027&ts=1362071369

推荐答案

我前几天碰到了同样的问题,在拉我的头发在做什么。

I ran into the same issue a few days ago and was pulling my hair out over what to do.

本来我有我的应用程序中设置了标签的碎片的方式看的这里避免pcated TabActivity去$ P $和使用的这个破解,让我将地图V1与片段。它基本上只是掩盖了一个活动的一个片段。

Originally I had my app set up with "Tabs the Fragment way" as seen here to avoid the deprecated TabActivity, and used this hack to allow me to incorporate Maps v1 in with the Fragments. It basically just masks an Activity as a Fragment.

但随后切换到TabActivity进一步下跌的轨道简单/这是更适合于整个应用程序。 但现在显然这2个地图V2片段问题已经成为一个问题。

But then switched to TabActivity further down the track for simplicity / it was better suited for the whole app. But now obviously this 2x Maps v2 fragment problem has become an issue..

所以,我已经恢复到制表符碎片,只是有黑客设置上述每一个标签,它允许有一个活动的每个选项卡,并有一个以上的地图v2中显示为每个标签。我还没有考虑太多深度,但它似乎是在做这项工作的ATM,与刚刚抛出一些code一起进行测试了。

So I have reverted back to "Tabs with Fragments" and just have the "hack setup" as mentioned above for each tab, which allows to have an Activity for each tab, AND having more than one Maps v2 displaying for each Tab. I haven't gone into too much depth with it, but it seems to be doing the job atm, with having just thrown some code together to test it out..

不知道,如果你仍然有一个问题,这个/这显然不是最正确的解决方案,而只是想我会分享我的两分钱柜面你仍然需要它。

Don't know if you're still having an issue with this / this obviously isn't the most correct solution, but just thought I'd share my two cents incase you still needed it.

干杯。