zoukankan      html  css  js  c++  java
  • android:configChanges不被调用的问题

    同样是由于SDK版本引发的问题。版本高的更加严谨,限制更多。

    "orientation" The screen orientation has changed — the user has rotated the device.

    Note: If your application targets API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), then you should also declare the "screenSize" configuration, because it also changes when a device switches between portrait and landscape orientations.

    "screenSize" The current available screen size has changed. This represents a change in the currently available size, relative to the current aspect ratio, so will change when the user switches between landscape and portrait. However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).

    Added in API level 13.

    So,大意就是SDK版本13或以上的,需要同时用orientation与screenSize。因为当设备横竖屏切换时,相应的屏幕大小也改变了。所以在Activity配置中正确写法为

    android:configChanges="orientation|screenSize"

    同时,我们可以知道screenSize这个配置改变并不会导致Activity的reStart。

  • 相关阅读:
    第五周作业
    关于结对编程的理解
    第四周作业
    总结
    总结
    总结
    总结
    总结
    判断树、判断表
    总结
  • 原文地址:https://www.cnblogs.com/Traveller-Leon/p/4643830.html
Copyright © 2011-2022 走看看