NavigationAdvancedSample: Fragment animations run when switching tabs
See original GitHub issueWhen setting animations on the action action_title_to_about
in home.xml
navigation graph as below:
We now get a nice fade-in fade-out animation when navigating from Home -> About. The issue is, when we switch tabs and return to the home tab, the fade-in animation is re-run.
Is this intended behaviour? Or a consequence of using a separate NavHostFragment
for each tab? We’d like the animations to be run when navigating within the tab, but not when switching tabs.
I’m considering this is as an issue with the samples rather than the navigation component as it may be down to how NavigationExtensions
implements the attaching/detaching of the NavHostFragments
.
Any help/workarounds would be appreciated 😄
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Fragment animations run when switching tabs · Issue ... - GitHub
We'd like the animations to be run when navigating within the tab, but not when switching tabs. I'm considering this is as an...
Read more >Navigate between fragments using animations
First, you need to create animations for your enter and exit effects, which are run when navigating to a new fragment. You can...
Read more >Separate Back Stack for each tab in BottomNavigationView ...
I am using Fragments to set the content for each tab. I know how to set up one fragment for each tab and...
Read more >Support multiple back stacks for Bottom tab navigation
Changing tab with the bottom bar resets the state and backstack of the ... the switch tab animation is overriden by current fragment...
Read more >Fragment Navigation in Android Using FragNav Library
Maybe you want to eagerly pre-instantiate all root Fragments to make switch between tabs quicker? This too is just one line of code....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this one https://androidwave.com/android-paging-library/
Fixed in
androidx.fragment:fragment:1.1.0-beta01
https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0-beta01