旋转动画
[html]
rotate_and_scale.xml
[html] view plaincopy
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="https://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>
[java]
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() {
<span style="white-space:pre"> </span>@override
public void onclick(view v) {
img1.setanimation(mrotateanim);
}
});
作者:kechanghe0705