最近遇到這個問題,一個activity中有一個imageview的旋轉動畫,當activity剛打開時,前幾秒這個旋轉的動畫沒有轉動的過程,過了0.幾秒以後直接卡到某個未知接着轉.到處搜索都是說activity出現時的過渡動畫的問題,感覺人類語言不足以精簡的表達這種事情ORZ.
It’s important to note that the start() method called on the AnimationDrawable cannot be called during the onCreate() method of your Activity, because the AnimationDrawable is not yet fully attached to the window.
大致就是說將startAnimation放到onWindowFocusChanged中就好了,然後試了試因爲視覺差還是感覺卡頓,於是直接將動畫delay了,確實有效.