2013-05-02 3 views
0

touchListener으로 손가락으로 움직일 수있는 ImageView이 있습니다. 사용자가 버튼을 눌러 의 두 위치를 저장하고 그 후에 버튼을 눌러 animation을 재생하면 첫 번째 위치에서 시작하여 두 번째 위치로 끝내기를 원합니다. 어떻게 가능합니까? 나는 getXgetY를 사용하여 배열에있는 두 개의 위치를 ​​저장하여 시도 후에는 TranslateAnimation에 넣어하지만시작 위치와 끝 위치를 저장하여 ImageView 애니메이션하기

public void get1Cos(){ 
     x[1] = player.getX(); 
     y[1] = player.getY(); 
} 
public void get2Cos(){ 
     x[6] = player.getX(); 
     y[6] = player.getY(); 
} 
anim = new TranslateAnimation(x[1], x[6], y[1],y[6]); 
anim.setFillAfter(true); 
anim.setDuration(2000); 
player.startAnimation(anim); 

답변

0

이 시도 작동하지 않습니다

player.startAnimation(animation); 
+0

나는 이것을 시도. 내가 잊어 버렸기 때문에 단순히 여기에 두지 않았다. 나는 고쳐. – user2273777

+0

"startAnimation"을 사용하면 애니메이션이 작동합니까? – baronS

+0

animate yes,하지만 그것은 현재 위치에 상대적인 위치에서 시작하고 끝내며 저장했습니다. – user2273777

관련 문제