Monday, February 17, 2014
When you want to perform onCreate switch the screen anyway, no effect!
According to the online presentation, do not want to re-program switch the screen anyway onCreate,
Corresponding activity in AndroidManifest.xml which added a:
android: configChanges = "orientation | keyboardHidden"
The results have no effect, I do not know what is the reason?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
You sdk version?
From sdk 3.2 +, discovered when the phone screen rotation, add a new screenSize, this value will also change to occur. So to not want to redraw the screen, this also needs to screenSize added to the configuration file.
android: configChanges = "orientation | keyboardHidden | screenSize"
Android Developer described as follows:
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.
Reply:
Yes, I look at someone else's blog, and finally see what this description:
Android fragmentation sigh again!!!!
Activity in the AndroidManifest.xml set android: configChanges = "keyboardHidden | orientation | screenSize"
Android4.0 need to set screenSize be effective.
2.2, 2.3, these simply set keyboardHidden | orientation
4.0 -> keyboardHidden | orientation | screenSize
Reply:
Wasted half the afternoon
Reply:
Thank you!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment