2012-07-18 75 views
1

我需要繪製在畫布上移動的位圖,我需要通過矩陣從TransalteAnimation安卓TransalteAnimation位圖

移動它,我有這樣的代碼:

float[] values = new float[9]; 
TranslateAnimation slide = new TranslateAnimation(-100,100, 0, 0); 
slide.setDuration(100); 
slide.setRepeatCount(TranslateAnimation.INFINITE); 
slide.setRepeatMode(TranslateAnimation.REVERSE); 
slide.setFillAfter(true); 
Transformation transform = new Transformation(); 
slide.start(); 
slide.getTransformation(AnimationUtils.currentAnimationTimeMillis(), transform); 
      transform.getMatrix().getValues(values); 

,但它從來沒有改變過,值始終是: [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]

哪裏出錯了?

其作品的任何其他類型的動畫:RotateAnimation,AlphaAnimation和等。它不是工作完全在翻譯動畫

回答

0

找到答案,它需要調用slide.initialize(0, 0, 0, 0);