我在一个 Activity 中,它必须在加载其余内容时播放 AnimationDrawable(“加载”动画)。我在另一个线程中开始了动画,因为动画往往会给主线程很多工作,但是动画无法正确显示,并且 Logcat 多次显示已跳过 40 帧左右。明天我会发布代码,抱歉延迟。同时是什么原因造成的?所有线程内部都是动画drawable的启动方法。
问问题
423 次
1 回答
0
You should not run animation off of the UI thread ("main" thread) - you should load your content in another thread by using a Loader (or something similar) and play the animation on the UI thread. That's what it's for.
Here are official thread guidelines:
Do not block the UI thread
Do not access the Android UI toolkit from outside the UI thread
于 2014-11-06T21:46:58.220 回答