android:configChanges

Lists configuration changes that the activity will handle itself. When a configurationchange occurs at runtime, the activity is shut down and restarted by default, but declaring aconfiguration with this attribute will prevent the activity from being restarted. Instead, the activity remains running and its onConfigurationChanged() method is called.

Note: Using this attribute should be avoided and used only as a last resort. Please read Handling Runtime Changes for more information about how to properly handle a restart due to a configuration change.

Any or all of the following strings are valid values for this attribute. Multiple values are separated by '|' — for example, "locale|navigation|orientation".

通过上面介绍获悉:

当配置list中有发生修改时,activity会自动的结束并重启,但是不会从onCreate 和 onRestart,而是从onConfigurationChanged()开始。

list中的配置是用符号“|”来分隔。


android:configChanges=["mcc", "mnc", "locale",                "touchscreen", "keyboard", "keyboardHidden",                "navigation", "screenLayout", "fontScale", "uiMode",                "orientation", "screenSize", "smallestScreenSize"]

mmc:The IMSI mobile country code (MCC) has changed — a SIM has been detected and updated the MCC.

移动国家号码,由三位数字组成,每个国家都有自己独立的MCC,可以识别手机用户所属国家。

mnc :The IMSI mobile network code (MNC) has changed — a SIM has been detected and updated the MNC.

移动网号,在一个国家或者地区中,用于区分手机用户的服务商。

local:The locale has changed — 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 revealed the hardware keyboard.

用户打开手机硬件键盘。

navigation :The navigation type (trackball/dpad) has changed. (This should never normally happen.)

screenLayout :The screen layout has changed — this might be caused by a different display being activated.

fontScale :The font scaling factor has changed — the user has selected a new global font size.

uiMode :The user interface mode has changed — this can be caused when the user places thedevice into a desk/car dock or when the night mode changes. SeeUiModeManager. Added in API level 8.

orientation :The screen orientation has changed — the user has rotated the device.

Note: If your application targets API level 13 or higher (asdeclared by theminSdkVersion and targetSdkVersion attributes), then you should also declare the"screenSize"configuration, because it also changes when a device switches between portrait and land scape orientations.

设备旋转,横向显示和竖向显示模式切换。note中显示API level大于13的话要申明screenSize属性

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 oforientation, 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, thenyour activity always handles this configuration change itself (this configuration change does notrestart your activity, even when running on an Android 3.2 or higher device).

Added in API level 13.

屏幕的物理尺寸发生变化,例如切换到一个外接的显示设备

layoutDirection :The layout direction has changed. For example, changing from left-to-right (LTR) to right-to-left (RTL).Added in API level 17.



更多相关文章

  1. Android(安卓)音乐播放器实现歌词显示
  2. Android(安卓)Popupwindow 显示ListView
  3. android listview无限循环显示数据
  4. Android(安卓)安卓 案例
  5. Android监控软键盘变化实例
  6. Android(安卓)Api WindowManager.LayoutParams
  7. android 键盘弹起 UI上移
  8. android登录超时显示demo
  9. Android(安卓)打开软键盘

随机推荐

  1. android View
  2. ReactNative踩坑大全
  3. cocos2dx编译HelloWorld
  4. Android(安卓)Studio 工程报错问题积累总
  5. Android(安卓)指定销毁一个Activity
  6. Android(安卓)oom pthread_create (1040K
  7. Android(安卓)P 横屏 部分应用宽度未占满
  8. android --相机使用详解概述
  9. 2011年沈大海讲师Android的新浪微博客户
  10. Android:使用JDBC链接MySQL数据库