当我旋转我的设备时,Google map v2 会刷新。如何防止发生此刷新?我在 SherlockFragment 的选项卡中动态添加 map 。
最佳答案
我通过添加到 AndroidManifest.xml 中的 Activity 解决了这个问题:
android:configChanges="orientation|screenSize"
编辑(2017 年 4 月 28 日):
Note: Using this attribute should be avoided and used only as a last resort. Please read Handling Runtime Changes for more information about how to properly handle a restart due to a configuration change.
也许你可以看看this answer ,它使用 FragmentActivity
的 onCreate
方法中可用的 Bundle
正确保存了 SupportMapFragment
。
关于Android - 不要在旋转时刷新 Google Maps v2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20589936/