多个地图视图?

发布于 2024-10-31 09:51:58 字数 169 浏览 2 评论 0原文

我有一个应用程序,有两个地图视图,一个是卫星视图,一个是街景视图。即使其中一个设置为 setStreetView(true); 而另一个设置为 setSattelite(true);,它们仍然显示为卫星视图。我怎样才能让两个视图显示不同的地图?

提前致谢。

I have an application that has two map views one satellite and one street view. They both keep showing up as a satellite view even though one is set to setStreetView(true); and the other is set to setSattelite(true);. How would I get it so that both views show different maps?

Thanks in advance.

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

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

发布评论

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

评论(2

柳絮泡泡 2024-11-07 09:51:58

假设您正在谈论同时显示两者,这似乎是不可能的。看
如何在一个 Activity 上创建 2 个 MapView

更新为回复评论。

根据 Google 地图 API MapActivity,"每个进程仅支持一个 MapActivity,同时运行的多个 MapActivity 可能会以意想不到的方式产生干扰。”因此,即使您有两个不同的 MapActivities,您也​​必须处理 进程生命周期,其中一个活动可能是可见的,而另一个活动是背景,这就是您遇到问题的地方。

第二次更新

因此根据此线程 MapView 和 MapActivity 的局限性 一位评论者在两个 MapActivity 之间放置了一个单独的活动,并且能够使其工作,但否则您将不得不使用覆盖/找到一种方法使您的应用程序仅与一个一起工作地图活动。

Assuming you are talking about showing both at the same time, it doesn't appear to be possible. See
How to Make 2 MapView on One Activity

Updated to respond to comment.

Per the Google Map API MapActivity, "Only one MapActivity is supported per process. Multiple MapActivities running simultaneously are likely to interfere in unexpected and undesired ways." So even if you have two different MapActivities you have to deal with the Process Lifecycle, where perhaps one activity is visible and the other activity is background and that is where you are getting problems.

2nd Update

So according to this thread Limitations of the MapView and MapActivity one commenter put a separate activity between two MapActivities and was able to make it work, but otherwise you will have to use overlays/find a way to make your app work with only one MapActivity.

飘过的浮云 2024-11-07 09:51:58

此处提出了一个解决方案

众所周知,在一个进程中使用多个地图视图时可能会遇到一些问题。如果您没有配置任何特定的内容,通常会出现这种情况(您的应用程序在一个进程中运行)。您可以使用清单中的 android:process 属性来分配给您的活动

A solution is proposed here.

It's known that you might experience some issues when using multiple mapviews in one process. Usually this is the case (your app running in one process) if you don't configure anything specific. You could though use the android:process attribute in your manifest to assign to your activites

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