我有一個objectAnimator了Thread.sleep不工作的Android
final ObjectAnimator anim = (ObjectAnimator) AnimatorInflater
.loadAnimator(getActivity(), R.anim.flip);
anim.setTarget(tvDebitAmount);
anim.setDuration(3000);
anim.start();
我需要這在一個循環工作,具有一定的差距。我的意思是,一旦這個動畫完成,我需要等待4000毫秒後再次調用anim.start。
我試圖把它在一個無限循環,並anim.start後放了Thread.Sleep()()。它不工作(整個屏幕沒有響應)。我怎樣才能讓它等待/睡覺?
了Thread.sleep應該睡在你調用它的線程。當你睡在GUI線程時,你可以阻止它做其他事情,比如更新屏幕或響應事件。換句話說Thread.sleep工作正常。在您從事件處理返回之前,屏幕不會更新。 –