I rotate the FAB in this simple way:
fab.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate));
rotate.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="1000"/> </set>
This works, but with the FAB its shadow rotates. But I only need FAB to rotate (or even an src image if there is any difference).
android rotation android-animation floating-action-button
danpetruk
source share