Android – How to cancel BottomNavigationView animation when pressing any item

So I have been developing an app with Kotlin and I decided to use com.google.android.material.bottomnavigation.BottomNavigationView to let the user navigate between the "main" activities.

The navigation between activities works fine, except that there is always that slide animation from right to left when a new activity starts.

I have tried

overridePendingTransition(0, 0)

This stops the slide animation, but a new fade animation seems to be triggered (it fades fast, but it is like a fast flash from a camera).

I have also tried FLAG_ACTIVITY_NO_ANIMATION when starting a new activity but it doesn't solve the problem either.

And finally I tried adding <item name="android:windowAnimationStyle">@null</item> to my app theme and once more the slide animation stops, but the fade animation is triggered.

What I want is to cancel any animation and simple load the new activity (all the apps I use seem to don't use any animation when an item from bottomnavigation is pressed).

I appreciate any help



Read more here: https://stackoverflow.com/questions/66268521/android-how-to-cancel-bottomnavigationview-animation-when-pressing-any-item

Content Attribution

This content was originally published by Linha at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: