如果我在 Activity 中有无限动画并离开 Activity,是否会导致内存泄漏?我必须明确停止动画还是在框架级别以某种方式进行管理?我所说的无限动画是什么意思:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:repeatCount="infinite">
<rotate
android:duration="1000"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="restart"
android:toDegrees="360" />
最佳答案
来自开发者网页:
您通常应该使用 onPause() 回调来: 停止动画或其他可能消耗 CPU 的正在进行的操作。
来源:http://developer.android.com/training/basics/activity-lifecycle/pausing.html#Pause
关于Android动画内存泄漏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30874547/