Skip to content
Advertisement

how to use Navigation component navhostfragment while altering full screen/above bottom Navigation

I’m using the single activity multi fragments with navigation component.how do i hide the bottom navigation bar for some of the fragments?

i tried the following:

  1. controlling the visibility of the bottomnavigation bar through databinding.(buggy)
  2. toggling the bottomnavigation visibility before opening the fragment and on the backstack ( buggy)
  3. making 2 host fragments: 1 full screen, 1 bound by the bottomnavigation
  4. making 2 navgraphs ..

activity_main.xml:

JavaScript

mainactivity.java:

JavaScript

the bottomnavbar blinks when switching between full screen fragments and normal fragments

Advertisement

Answer

i used OnDestinationChangedListener, as @Lavepe answered … sorry didnt check here for a long time here is my code:

JavaScript

the ui function:

JavaScript

the view above it is :

JavaScript

Best Regards Hope You Find it Useful

Advertisement