This question has already been answered:
Is it possible to create Navigation Drawer in a separate fragment, if so how? And if not, then how to do it right, just say that the approach with the fragments is more correct.
This question has already been answered:
Is it possible to create Navigation Drawer in a separate fragment, if so how? And if not, then how to do it right, just say that the approach with the fragments is more correct.
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
It is impossible. And if it is possible, it is not necessary. I think that you have a little misunderstood what you were told. A good practice is to use NavigationDrawer in one activity, putting any number of fragments into it.
If a part of the interface should contain NavigationDrawer , and the other is not, then the most correct solution would be to divide the interface into at least two activites, one of which implements NavigationDrawer and hosts fragments that this drover also needs to implement, the second does not implement it and, if necessary, Host fragments that also do not have to implement a drover, but are connected by chains of transitions, or switch to other activites that also do not implement a drover.
Also, if a drover has to realize only one screen, then the use of fragments is generally doubtful. It is also worth noting that there are solutions with a drover and several screens that do not use fragments.
At the end, my opinion on how to decide whether you need fragments in general in your application.
Source: https://ru.stackoverflow.com/questions/626388/
All Articles