For API 12 and below: add
android:configChanges="orientation"
Add "screenSize" if you are targeting API 13 or above because whenever your orientation changes so does your screen size, otherwise new devices will continue to destroy your activity.
android:configChanges="orientation|screenSize"
to your Activity in AndroidManifest.xml. This way your Activity wont be restarted automatically.
本文探讨了在Android应用开发中,如何通过在AndroidManifest.xml中配置`android:configChanges`属性来减少应用在不同设备和屏幕尺寸、旋转情况下的Activity重启,从而提升用户体验。
2378

被折叠的 条评论
为什么被折叠?



