问题
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