What does the android:configChanges=“screenSize” attribute do?

倖福魔咒の 提交于 2021-02-18 22:42:15

问题


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

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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/25120903/what-does-the-androidconfigchanges-screensize-attribute-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!