1
下面的代碼有時會導致一些混亂和滯後,我不知道它有什麼問題。動畫引起混亂後有時造成滯後
的代碼塊是讓爲觀看動畫屏幕中隨機
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
int nextX = random.nextInt(width);
int nextY = random.nextInt(height);
animation1 = null;
animation2 = null;
animation1 = ObjectAnimator.ofFloat(currentView, "x", previousX,
nextX);
animation1.setDuration(ANIMATION_TIMING);
animation2 = ObjectAnimator.ofFloat(currentView, "y", previousY,
nextY);
animation2.setDuration(ANIMATION_TIMING);
set.playTogether(animation1, animation2);
set.setStartDelay(250);
set.start();
previousX = nextX;
previousY = nextY;
}
logcat的
01-16 17:18:12.237: D/dalvikvm(18091): GC_CONCURRENT freed 1451K, 15% free 9621K/11207K, paused 2ms+2ms
01-16 17:18:27.209: D/dalvikvm(18091): GC_CONCURRENT freed 1825K, 18% free 9639K/11655K, paused 1ms+3ms
01-16 17:18:41.926: D/dalvikvm(18091): GC_CONCURRENT freed 1801K, 18% free 9661K/11655K, paused 2ms+2ms
你能爲你所遇到的滯後/挺舉加上你所要求的,GC這可能會導致延遲,如果它運行的時間添加日誌。 –
兄弟你會告訴你在listview中應用這個動畫的位置? –
@RavindMaurya正在申請一個按鈕。 –