一般在AndroidManifest.xml文件中都没有使用到android:configChanges="keyboardHidden|orientation"配置,当然还是很有用的。
就是如果配置了这个属性,当我们横竖屏切换的时候会直接调用onCreate方法中的onConfigurationChanged方法,而不会重新执行onCreate方法,那当然如果不配置这个属性的话就会重新调用onCreate方法了

android:configChanges=["mcc", "mnc", "locale",
"touchscreen", "keyboard", "keyboardHidden",
"navigation", "screenLayout", "fontScale", "uiMode",
"orientation", "screenSize", "smallestScreenSize"]
mcc:The IMSI mobile country code (MCC) has changed — a SIM has been detected and updated the MCC.
IMSI(国际移动用户识别码)发生改变,检测到SIM卡,或者更新MCC
mnc:The IMSI mobile network code (MNC) has changed — a SIM has been detected and updated the MNC.
IMSI网络发生改变,检测到SIM卡,或者更新MCC
其中mcc和mnc理论上不可能发生变化
locale: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.)
导航发生改变,(这通常不应该发生) 举例:连接蓝牙键盘,连接后确实导致了navigation的类型发生变化。因为连接蓝牙键盘后,我可以使用方向键来navigate了
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.
全局字体大小缩放发生改变
orientation:The screen orientation has changed — that is, the user has rotated the device.设备旋转,横向显示和竖向显示模式切换。
screenSize: 屏幕大小改变了
smallestScreenSize: 屏幕的物理大小改变了,如:连接到一个外部的屏幕上
4.2增加了一个layoutDirection属性,当改变语言设置后,该属性也会成newConfig中的一个mask位。所以ActivityManagerService(实际在ActivityStack)在决定是否重启Activity的时候总是判断为重启。
需要在android:configChanges 中同时添加locale和layoutDirection。
在不退出应用的情况下切换到Settings里切换语言,发现该Activity还是重启了。

关于android:configChanges的属性的更多相关文章

  1. Android疑难杂症之android:configChanges="orientation" 无效

    通常情况下,当“屏幕方向”变化时会销毁并重建当前Activity.而我们有时候并不希望重新创建Activity实例,然后就会在AndroidManifest.xml中配置Activity: <a ...

  2. android:configChanges属性总结

    http://blog.csdn.net/zhaokaiqiang1992/article/details/19921703 android中的组件Activity在manifest.xml文件中可以 ...

  3. android:configChanges属性

    对android:configChanges属性,一般认为有以下几点: 1.不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏 ...

  4. &lt;Android&gt;从窗口泄漏谈android:configChanges属性

    今天有幸去哥们的大公司做了半天的暂时工,一个偶现的Bug折腾了他好久,好不easy今天抓到了异常Log日志.大致的意思就是android.view.windowleaked--窗口泄漏.我在网上查了资 ...

  5. 【Android进阶】android:configChanges属性总结

    android中的组件Activity在manifest.xml文件中可以指定参数android:ConfigChanges,用于捕获手机状态的改变. 在Activity中添加了android:con ...

  6. Android控件属性大全(转)

    http://blog.csdn.net/pku_android/article/details/7365685 LinearLayout         线性布局        子元素任意: Tab ...

  7. Android Configuration change属性

    问题:横竖屏切换时Activity的生命周期? 答案: 1.不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次 2 ...

  8. Android控件属性大全[整理转载]

    控件属性: android属性 Android功能强大,界面华丽,但是众多的布局属性就害苦了开发者,下面这篇文章结合了网上不少资料, 第一类:属性值为true或falseandroid:layout_ ...

  9. android4.0 禁止横竖屏切换使用 android:configChanges="orientation|keyboardHidden"无效

    android4.0 禁止横竖屏切换使用 android:configChanges="orientation|keyboardHidden"无效    在之前的版本中都是在Man ...

随机推荐

  1. Ubuntu 安装vim出错

    在Ubuntu 12.10中安装vim时出现了如下提示: www.linuxidc.com @linuxidc:/etc/apt$ sudo apt-get install vim正在读取软件包列表. ...

  2. Django教程:第一个Django应用程序(4)

    Django教程:第一个Django应用程序(4) 2013-10-09 磁针石 #承接软件自动化实施与培训等gtalk:ouyangchongwu#gmail.comqq 37391319 #博客: ...

  3. http://c7sky.com/works/css3slides/#1

    http://c7sky.com/works/css3slides/#1 css3 学习

  4. JSP视频

    web基础 http://pan.baidu.com/s/1Fy7nV

  5. Python爬取CSDN博客文章

    0 url :http://blog.csdn.net/youyou1543724847/article/details/52818339Redis一点基础的东西目录 1.基础底层数据结构 2.win ...

  6. spring 自定义schema

    扩展schema,定义自己的bean属性..不错! 主要: 1,定义META-INF下.xsd文件,这里是people.xsd;定义spring.handlers;定义spring.schemas 2 ...

  7. flume学习安装

    近期项目组有需求点击流日志须要自己收集,学习了一下flume而且成功安装了.相关信息记录一下. 1)下载flume1.5版本号  wget http://www.apache.org/dyn/clos ...

  8. mybatis0204 一对多查询

    查询所有订单信息及订单下的订单明细信息. sql语句 主查询表:订单表 关联查询表:订单明细 SELECT orders.*, user.username, user.sex , orderdetai ...

  9. Service 如何知道caller

    重写Binder的onTransact方法 1   you need to do that in Binder#onTransact method, this is a good place for ...

  10. WKWebView使用过程中的那些坑

    问题产生背景: 新开发的页面中有一部分的界面是需要展示后端接口返回的HTML代码,包括文字和图片.所以就自然而然的要使用iOS原生的WebKit. 鉴于Xcode 8发布以后,编译器支持的最低版本(D ...