1 Answers1

1

This can be easily done by subscribing to navigation component destination change listener, like this:

navController.addOnDestinationChangedListener { controller, destination, arguments ->
    if(destination.id = R.id.yourMainFragment) {
        // TODO hide/show your view here
    }
}

And then hiding/showing based on destination

Lukáš Anda
  • 560
  • 1
  • 5
  • 23