使用此代码旋转图像视图
musicDisc = (ImageView)findViewById(R.id.musicDisc);
rotation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.rotate);
rotation.setFillAfter(true);
musicDisc.startAnimation(rotation);
要停止播放,您可以使用清晰的动画
musicDisc.clearAnimation()
Rotating.xml保留在res文件夹中
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:startOffset="0"
android:toDegrees="360" />
</set>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句