gpt4 book ai didi

Android - 不要在旋转时刷新 Google Maps v2

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:13:33 27 4
gpt4 key购买 nike

当我旋转我的设备时,Google map v2 会刷新。如何防止发生此刷新?我在 SherlockFragment 的选项卡中动态添加 map 。

最佳答案

我通过添加到 AndroidManifest.xml 中的 Activity 解决了这个问题:

android:configChanges="orientation|screenSize"

编辑(2017 年 4 月 28 日):

来自Android Documentation :

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 ,它使用 FragmentActivityonCreate 方法中可用的 Bundle 正确保存了 SupportMapFragment

关于Android - 不要在旋转时刷新 Google Maps v2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20589936/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com