android:configChanges =“" screenSize"是什么?属性吗? [英] What does the android:configChanges="screenSize" attribute do?

查看:60
本文介绍了android:configChanges =“" screenSize"是什么?属性吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 AndroidManifest.xml Activity 的上述属性的作用以及原因(可能)需要吗?

I would like to know what the above mentioned attribute for an Activity in the AndroidManifest.xml does and why it (would be) needed?

我已经阅读了有关此主题的Android文档,对我的解释还不是很清楚.我想知道一个示例案例为什么,我必须设置此属性.

I have already read the Android documentation about this topic and the explaination is not quite clear to me. Id like to know an example case WHY I would have to set this attribute.

推荐答案

您可能已经知道,每次电话参数更改时,系统都会重建整个Activity以加载新资源.这些参数之一是屏幕尺寸,随着手机旋转角度的改变,屏幕尺寸可能会在手机上改变.

As you may have known every time a parameter of the phone changes the system rebuilds the whole Activity in order to load the new resources. On of these parameters is the screen size, which can change on a phone, as the rotation of the phone changes it.

如果您在清单中定义 android:configChanges ,则可以完全控制应用程序,这意味着系统不会销毁您的Activity,它只会调用 onConfiguratinChanged 方法.这样,您必须管理屏幕的调整大小.

If you define android:configChanges in your manifest you can have full control over your application, which means that the system won't destroy your Activity, it only calls the onConfiguratinChanged method of it. This way you have to manage the resizeing of the screen.

这篇关于android:configChanges =“" screenSize"是什么?属性吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆