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

标签 android screen-rotation

当我旋转我的设备时,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/

相关文章:

java - 从 Mac 系统上的控制台导航到 jdk 文件夹

自 Android 6 Marshmallow 以来,javax.crypto.Cipher 的工作方式有所不同

ios - 在 iPad 上锁定方向并禁用旋转

android - Adt 不会创建默认的 hello world 但命令行会

android - 无法执行 dex : Multiple dex files define Lcom/facebook/android/AsyncFacebookRunner$1;

android - 获取相对于父级的触摸事件坐标

ios - 相机应用程序,如屏幕旋转和导航

android - PhoneGap - 强制横向

java - Android Exoplayer 保存状态

Android 在屏幕旋转后从嵌套的 AsyncTask onPostExecute 保存数据