0
我在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会运行动画。我只想让动画只运行一次。我应该添加什么?