问题
Quoting the documentation:
Caution: Beginning with Android 3.2 (API level 13), the "screen size" also changes when the device switches between portrait and landscape orientation. Thus, if you want to prevent runtime restarts due to orientation change when developing for API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), you must include the "screenSize" value in addition to the "orientation" value. That is, you must decalare android:configChanges="orientation|screenSize"
I need to ignore the screenSize
config change. My minimum SDK level is 8 (Android 2.2), and target SDK level is 13. Therefore, I need to introduce it in the manifest.
However, Eclipse doesn't recognize it, because its Android setting is set to 2.2. So I've changed it to the proper level, and now it builds properly.
I'm afraid, however, that there will be issues on older versions where the screenSize
config change wasn't yet available. (E.g. when the app is run on Android 2.2. device.) That is, the application will crash when it reads the manifest, because screenSize
will be an unknown value for it. Or will it simply ignore it on pre-3.2 devices?
P.S.: I don't have the chance to test it on a real device now, and I wouldn't trust the emulator alone in such a critical matter.
回答1:
It will ignore it. Same is true for splitscreen action bar and other things that are similar. Unlike in java, any things the android os doesn't understand from the manifest it essentially ignores.
回答2:
Short answer: It gets ignored.
As a rule, values in the manifest that aren't recognized (like screenSize on a pre-2.2 device) get ignored for precisely this reason. Otherwise it wouldn't be possible for developers to use functionality added in new platform versions, without breaking backwards compatibility for older devices.
来源:https://stackoverflow.com/questions/14062663/older-devices-and-androidmanifest-configchanges-screensize