有时我们使用activity转场动画的时候,没有再demo流畅,原因可能是因为动画进行时,有同时加载数据等进行主线程操作,所以会导致动画不够流畅. 解决办法就是在动画结束后再进行数据加载等相关操作. activity里有一个方法
/** * Activities cannot draw during the period that their windows are animating in. In order * to know when it is safe to begin drawing they can override this method which will be * called when the entering animation has completed. */ public void onEnterAnimationComplete() { }这个就是在动画结束后的回调.这样效果就会好一些.
但是要注意的是该接口API21的,所以之前的旧版本就不能这么用了.
新闻热点
疑难解答