Android MapView 在另一个视图中更改
我有两个活动组,其中包含一个转到详细视图的列表。详细活动扩展了地图活动。一旦我设置了纬度/经度并添加了点并将其居中,一切就都很好。如果我去其他活动做同样的事情,两张地图都会随着每次纬度/经度的变化而变化。代码和视图 xml 是分开的,那么为什么两个地图都更改为相同的纬度/经度?
I have two activity groups that contain a list that go to a detail view. The detail activty extends a mapactivity. Once I set the lat/long and add the point and center it everything works great. If I go to the other activity to do the same thing, both maps are changing with each lat/long change. The code and view xml are seperate, so why are both maps changing to the same lat/long?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您查看 MapActivity 的文档,它说:每个进程仅支持一个 MapActivity。忽视这一点会导致除了您遇到的问题之外的各种问题。解决方法是将其中一个 MapActivities 放入单独的进程中。为此,请修改其中一项活动的清单条目并添加
android:process
属性,例如:请注意,将一项活动放在单独的进程中存在缺点。
If you look at the docs for MapActivity, it says: only one MapActivity is supported per process. Ignoring this causes all sorts of problems besides the ones you are experiencing. The workaround is to put one of the MapActivities in a separate process. To do this modify the manifest entry for one of your activities and add the
android:process
attribute, like:Note that there are downsides to putting one of the activities in a separate process.