I have some strange "glitch" and refresh issues with my application, using jetpack navigation library (2.3.5), Material Toolbar and view bindings.
The demo scenario is the following: a simple navigation between 3 different fragments.
ENTRY POINT ---> SCREEN C ---> SCREEN D
DISCLAIMER
Sorry for the "pseudo-blur boxes" on the screen, but I can't show the real UI, and if I change the fragment layout for demo purpose, the issue changes. So I need to use the real UI.
First step : ENTRY POINT ---> SCREEN C
The user enter in our app: an empty MaterialToolbar is on screen top, with a standard back icon.
Then the user tap on a button and enter into SCREEN C. When the SCREEN C is fully rendered, the Material Toolbar is updated with the screen title "SCREEN C", a custom navigation icon and a menu item on the right (the question mark icon).
As you can see in the gif, there are 2 main issues during the navigation:
- The screen title "SCREEN C" is initially shown with a very large font and wrong color (the white one). This is the style of the empty MaterialToolbar in the ENTRY POINT fragment.
- The back icon is initially the standard one, after a while (when the whole screen is rendered) it is changed with the custom navigationIcon.
Second step: SCREEN C ---> SCREEN D
The user is on "SCREEN C". Then tap on a card and enter into "SCREEN D".
When the SCREEN D is fully rendered, the Material Toolbar is updated with the screen title "SCREEN D", a custom back arrow icon and the menu item on the right will disappear.
As you can see in the gif, there are also some issues:
- First, the title "SCREEN D" is shown to the user, with the standard back icon and the menu item on the right
- Then, when "SCREEN D" is fully rendered, the back icon is the custom one and the menu item disappears.
The MaterialToolbar, in every fragment, is configured as following:
val navController = NavHostFragment.findNavController(fragment)
val appBarConfiguration = AppBarConfiguration(navController.graph)
setupWithNavController(navController, appBarConfiguration)
This is called in the fragment onViewCreated callback.
Why there is such rendering issue during every navigation step?



