我已经对我的按钮使用了旋转动画。它在Android 5.0及更高版本上运行良好,但在Android 4.4版本上进行测试。其闪烁并不旋转。正如一些其他人所建议的,我尝试过使用图层类型,之后填充并填充。但没有任何工作。下面是我的代码:旋转动画不适用于Android 4.4.4
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="200"
android:fromDegrees="0"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="0"
android:toDegrees="180"
android:repeatMode="reverse">
</rotate>
</set>
Animation mAnim = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate);
mAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
exchangeValues();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
if (floatingActionButton != null) {
floatingActionButton.startAnimation(mAnim);
}
什么是ANIMATION_NAME? –
什么是'ANIMATION_NAME'?什么是'exchangeValues'? – Divers