I want to put an animation when i am taping the tab i want image rotation animation on tab icon. Below is the Example but it is in iOS.
The following approach might work: Create an AnimatedVectorDrawable
as illustrated here https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html and set it as your tab's icon.
Assign a listener to your TabLayout, in TabLayout.OnTabSelectedListener#onTabSelected(TabLayout.Tab tab)
you have access to the tab's icon using tab.getIcon()
. Run the animation associated with your AnimatedVectorDrawable
like so:
final Drawable icon = tab.getIcon();
((Animatable) icon).start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With