- When a configuration change occurs at runtime, the activity is shut down and restarted by default.
- But declaring a configuration with this attribute will prevent the activity from being restarted. Instead, the activity remains running and its onConfigurationChanged() method is called.
- 在預設上,當任一屬性改變時,activity 會被關閉並且重啟;但若有指定此設定及屬性,則當被指定屬性改變時,activity會執行並通知系統 call onConfigurationChanged().
* Attribute values
- mcc
- The IMSI mobile country code (MCC) has changed — that is, a SIM hasbeen detected and updated the MCC.
- IMSI 中的移動國家號碼,有三位數,每個國家都有自己獨立的MCC,可以識別手機用戶所屬國家。
- mnc
- The IMSI mobile network code (MNC) has changed — that is, a SIM hasbeen detected and updated the MNC.
- 在一個國家或地區中,用於區分手機用戶的服務商。
- locale
- The locale has changed — for example, the user has selected a new language that text should be displayed in.
- 使用者的所在區域改變。
- touchscreen (?)
- The touchscreen has changed. (This should never normally happen.)
- keyboard
- The keyboard type has changed — for example, the user has plugged in an external keyboard.
- keyboardHidden
- The keyboard accessibility has changed — for example, the user has slid the keyboard out to expose it.
- navigation (?)
- The navigation type has changed. (This should never normally happen.)
- orientation
- The screen orientation has changed — that is, the user has rotated the device.
- 螢幕直向與橫向的轉換。
- fontScale
- The font scaling factor has changed — that is, the user has selected a new global font size.
- 字體改變大小。
- uiMode (?)
- The user interface mode has changed — this can be caused when the user places the device into a desk/car dock or when the the night mode changes. See UiModeManager.
- Introduced in API Level 8.
- CAR_MODE or DESK_MODE....
- 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.
- smallestScreenSize
- The physical screen size has changed.
- This represents a change in size regardless of orientation, so will only change when the actual physical screen size has changed such as switching to an external display.
- A change to this configuration corresponds to a change in the smallestWidth configuration.
- 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.
* Reference
- Android ConfigChanges用法 - Android实例教程 - Android开发论坛 - 安卓开发论坛 - Android开发
- Android Developer - android:configChanges
沒有留言:
張貼留言