Androidのアニメーションボタンに問題があります。これは私のコードです:
private void RunAnimations() {
Animation a = AnimationUtils.loadAnimation(this, R.anim.alpha);
a.reset();
Button tv = (Button) findViewById(R.id.button1);
tv.clearAnimation();
tv.startAnimation(a);}
@Override
public boolean onTouchEvent(MotionEvent event){
if(event.getAction()== MotionEvent.ACTION_DOWN){
RunAnimations();
}
return false;
}
問題は、画面が OnTouch の場合にアニメーションが実行されることです。アニメーションを 1 回だけ実行したい。何を追加すればよいですか?