1

There are 1 best solutions below

0
Lukáš Anda On BEST ANSWER

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