레이아웃에서 왼쪽에서 오른쪽으로 이미지를 이동하려고하지만 드래그하지는 않습니다. 나는 그것이 무언가가 일어날 때 자동적으로 가고 싶다. 그래서 저는 다음과 같은 애니메이션을 발견했습니다 :애니메이션으로 움직이는 이미지를 멈추는 방법은 무엇입니까?
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator" >
<translate
android:duration="1000"
android:fromXDelta="0"
android:toXDelta="200"
android:fillEnabled="true"
android:fillAfter="true" />
</set>
그러나 문제는 내가 그것을 멈출 수있는 방법을 찾지 못했습니다! 방금 직접 돌아 왔습니다. 어떤 제안이라도 제발?
public void onClick(View v) {
runOnRight(this, image);
}
static Animation runOnRight(Activity ctx, View target) {
Animation animation = AnimationUtils.loadAnimation(ctx,
R.anim.slide_left_to_right);
target.startAnimation(animation);
return animation;
}
제안 사항에 android : fillAfter = "true"를 추가했지만 여전히 멈추지 않습니다. – yahya