51

我不确定我应该使用MapView还是坚持使用MapFragment. 我的应用程序是一个应用程序,它可以找到离您最近的一组地点。我希望能够添加位置,在按下标记时显示标记的详细信息,当用户沿地图移动时,我希望能够获取地图中心的坐标并显示定义的最近位置半径。如果我继续使用,我会处于劣势还是应该在我还有机会的时候MapFragments切换到?MapView

4

2 回答 2

57

首先,很快 MapView 和 Google Maps API V1 将停止支持并且不会收到任何新的更新。很快所有的支持都会消失。

其次,现在 MapFragment 可能不太灵活,但呈现的地图,操控起来看起来要好得多。我猜它的功能会随着时间的推移而改进。

所以我肯定会继续使用 MapFragments。

更新: 正如@Brian White 在评论中指出的那样,今天MapViewGoogle API V2中有一个,当你想在片段中嵌入地图时应该使用它。这样你就可以避免在不必要的时候级联碎片。

于 2013-03-06T00:31:33.727 回答
37

MapFragment

  • Use it if you want to add a map into Activity class (not fragment because it will create a nested fragment and it´s a mess).
  • Use SupportMapFragment if you want to support just android versions lower than v12.

MapView

  • Use it if you are going to add a map into a fragment. (you need to update each lifecicle to MapView).
于 2016-01-06T05:35:37.453 回答