The following points are generally considered for the Android:configchanges attribute:
1, do not set the activity of the android:configchanges, the screen will recall the various life cycle, cut across the screen will be executed once, cut the vertical screen will be executed twice
2, set the activity android:configchanges= "orientation", the screen will recall the various life cycle, cut horizontal, vertical screen will only be executed once
3, set the activity android:configchanges= "Orientation|keyboardhidden", the screen will not recall the various life cycle, will only execute onconfigurationchanged method
However, since the Android 3.2 (API 13), after setting the activity's android:configchanges= "Orientation|keyboardhidden", the same will recall the various lifecycles.
Because screen size also starts to change with the device's shift. So, when the Minisdkversion and Targetsdkversion properties set in Androidmanifest.xml are greater than or equal to 13,
If you want to prevent the program from reloading activity at run time, in addition to setting "orientation", you must also set "ScreenSize".
Workaround:
Set android:configchanges= "Orientation|screensize" in Androidmanifest.xml
Expansion:
by Setting this property, the activity captures the state of the device, and the following is what can be identified:
Config_font_scale
Config_mcc
Config_mnc
Config_locale
Config_touchscreen
Config_keyboard
Config_navigation
Config_orientation
Set method: Use the following fields with the "|" Symbols separated, for example: "locale|navigation|orientation
”
Value |
Description |
" MCC " |
The IMSI Mobile Country Code (MCC) has Changed-that are, a SIM hasbeen detected and updated the MCC. Mobile country number, consisting of three digits, each country has Their own independent MCC, can identify the mobile phone users of the country. |
" MNC " |
The IMSI Mobile Network Code (MNC) has Changed-that is, a SIM hasbeen detected and updated the MNC. Mobile network number, in a country or region, used for district breakup The service provider of the machine user. |
" locale " |
The locale has changed-for example, the user have selected a new language that text should is Displayed in. The user's location changes 。 |
" touchscreen " |
The touchscreen has changed. (This should never normally Happen.) |
" keyboard " |
The keyboard type has changed-for example, the user had plugged in an external keyboard. keyboard mode changes, for example: User access to external keyboard input. |
" Keyboardhidden " |
The keyboard accessibility has changed-for example, the user have slid the keyboard out to expose it. User opens the phone hardware keyboard |
" Navigation " |
The navigation type has changed. (This should never normally happen.) |
" Orientation " |
The screen orientation have changed-that is and the user has rotated the device. Equipment rotation, landscape display and vertical display mode switching. |
" Fontscale " |
The font scaling factor has changed-that are, the user has selected a new global font size. Global Font Size scaling changes |
Android:configchanges Property