You can use frame animation: you create 15-20 frames for the animation you want to make. You create an animation list, for example, animation_list.xml:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:duration="50" android:drawable="@drawable/frame_01"/> <item android:duration="50" android:drawable="@drawable/frame_02"/> <item android:duration="50" android:drawable="@drawable/frame_03"/> <item android:duration="50" android:drawable="@drawable/frame_04"/> <item android:duration="50" android:drawable="@drawable/frame_05"/> <item android:duration="50" android:drawable="@drawable/frame_06"/></animation-list>
Then you put it as src inside your custom FAB. Now you can start the frame-by-frame animation (when the FAB animation ends):
ImageView mImageViewFilling = (ImageView) findViewById(R.id.animated_imageview); ((AnimationDrawable) mImageViewFilling.getBackground()).start();
source share