有時(shí)我們使用activity轉(zhuǎn)場(chǎng)動(dòng)畫的時(shí)候,沒有再demo流暢,原因可能是因?yàn)閯?dòng)畫進(jìn)行時(shí),有同時(shí)加載數(shù)據(jù)等進(jìn)行主線程操作,所以會(huì)導(dǎo)致動(dòng)畫不夠流暢. 解決辦法就是在動(dòng)畫結(jié)束后再進(jìn)行數(shù)據(jù)加載等相關(guān)操作. activity里有一個(gè)方法
/** * 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() { }這個(gè)就是在動(dòng)畫結(jié)束后的回調(diào).這樣效果就會(huì)好一些.
但是要注意的是該接口API21的,所以之前的舊版本就不能這么用了.
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注