android - (支持)MapFragment 生命周期调用

标签 android supportmapfragment mapfragment

我刚刚开始使用 MapFragment(或者实际上是 SupportedMapFragment,因为我的目标是 API 8)。我过去从未使用过 MapView (V1)。

我注意到,在 MapView 上有人被告知从 Activity 进行生命周期调用(onPause() 等),但是在 (Supported)MapFragment 中没有关于这样做的记录,尽管它看起来确实具有相同的功能方法作为 MapView。

是否必须?

最佳答案

Fragment 处理自己的生命周期,这是它们的一大优点。如果您询问是否必须在 MapFragment 上显式调用 onResumeonPause 等...,答案是否定的。

Fragment 的要点是拥有模块化的 UI fragment ,您可以将它们放入应用的不同部分。例如,您可以在手机上切换 map fragment 和列表 fragment ,但在平板电脑上将它们并排放置。

关于android - (支持)MapFragment 生命周期调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15774282/

相关文章:

android - 是否可以在触摸发生时检测到指纹?

android - SupportMapFragment 与 ViewPager : Cannot move camera or change map settings

android - 第二次打开 SupportMapFragment 时出错

google-maps - 如何显示android mapfragment View 的圆形

android - 如何使用 SupportMapFragment 而不是 MapFragment

android - 在 Facebook SDK 4 (Android) 中创建请求

android - Android ListView 和 DB

安卓工作室 : Error inflating class fragment

android - 如何隐藏 map fragment - Android

android - Mapbox 不在 fragment 中开始