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。

  • 相关阅读:
    hdu 1251(字典树)(3种方法)
    HDU 2203(KMP算法)
    九度oj 题目1335:闯迷宫
    poj3894 bfs+记录路径
    状压dp--P2704
    状压dp--洛谷P2622
    动态规划--牛客多校number
    完全背包
    01背包--hdu
    莫比乌斯反演模板--Gym 101982B
  • 原文地址:https://www.cnblogs.com/Traveller-Leon/p/4643830.html
Copyright © 2011-2022 走看看