2015-05-28 24 views
-1

我正在製作動畫從0,100到各自的位置創建TextView,更詳細的圖片視圖。動畫從一個點到各自的位置android

從左上角到加載UI時創建的textview。

enter image description here
並且,法線指示從頂部移動到textview位置。

enter image description here

簡單的方式,左上角到任何位置的動畫

在此先感謝。

+0

我已經張貼的答案,這將幫助你http://stackoverflow.com/questions/30170786/how-to-fill-a-view-with-another -with材料設計動畫/ 30318641#30318641 –

回答

0

您可以使用此方法:

private void translateTextView(TextView textView, int targetX, int targetY) { 
     AnimatorSet animSetXY = new AnimatorSet(); 

     ObjectAnimator y = ObjectAnimator.ofFloat(v, 
        "translationY",textView.getY(), targetY); 

     ObjectAnimator x = ObjectAnimator.ofFloat(v, 
        "translationX", textView.getX(), targetX); 

     animSetXY.playTogether(x, y); 
     animSetXY.setInterpolator(new LinearInterpolator(1f)); 
     animSetXY.setDuration(300); 
     animSetXY.start(); 
    } 
相關問題