我怎么能停止动画..这是我的代码 import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.widget.Button;imp
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
public class animation extends Activity {
ImageView img;
Animation an;
Button bt;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
img = (ImageView)findViewById(R.id.ImageView01);
an = AnimationUtils.loadAnimation(this, R.anim.anim);
bt= (Button)findViewById(R.id.Button01);
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
img.startAnimation(an);
}
});
}
}
我假设您的动画(an)无限运行.当你想要停止使用img.clearAnimation();.
