X-Black...
X-Black...

Reputation: 1596

BottomNavView remains hidden onNavigation between Fragments

Prior to this question, i implemented the HideBottomViewOnScrollBehaviour to the BottomNavVew, and onDestinationChangedListenerin each fragment to control the visiblity of the BottomNavView

Bug : when i scroll-down and the BottomNavView collapse/hide in FragmentA and i try navigating to the FragmentB, the BottomNavView remains hidden, but if i scroll-up justt for the BNV to re-appear and try switching to the same fragment, the BNV becomes visible,

can anyone help with an explanation...?

Upvotes: 0

Views: 51

Answers (1)

Neo Luk
Neo Luk

Reputation: 581

because when you navigate from A to B. The listener in Fragment A will be destroyed with Fragment A. And Fragment B will not receive and destination change because there is no change yet. As you init it again in Fragment B so it doesn't know you come from A.

Just put the onDestinationChangedListener with visibility logic in Activity.

Upvotes: 1

Related Questions