rotate_and_scale.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:duration="5000" android:repeatMode="restart" android:repeatCount="infinite" /> </set>
final ImageView img1=(ImageView)this.findViewById(R.id.imageView1);
Button btn=(Button)this.findViewById(R.id.button1);
final Animation mRotateAnim= AnimationUtils.loadAnimation(this, R.anim.rotate_and_scale);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
img1.setAnimation(mRotateAnim);
}
});