< ?xml version="1.0" encoding="utf-8"?> < set xmlns:android="http://schemas.android.com/apk/res/android"> < rotate android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:fromDegrees="0" android:toDegrees="+360" android:duration="3000" /> < !-- rotate 旋转动画效果 interpolator 指定一个动画的插入器,用来控制动画的速度变化 fromDegrees 属性为动画起始时物件的角度 toDegrees 属性为动画结束时物件旋转的角度,+代表顺时针 duration 属性为动画持续时间,以毫秒为单位 --> < /set> public class TestAnimation extends Activity implements OnClickListener{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button btn = (Button)findViewById(R.id.Button01); btn.setOnClickListener(this); } @Override public void onClick(View v) { Animation anim = AnimationUtils.loadAnimation(this, R.anim.my_rotate_action); findViewById(R.id.TextView01).startAnimation(anim); } }