Search code examples
androidandroid-layoutandroid-toolbarnavigationviewandroid-navigationview

Implement Same Navigation View along different Activites in Android


Perhaps somebody can help me understand this question about the subject. I already made my navigation view, but now I want the same navigation view in my other 2 activities. What I don't understand is how should I properly implement my layouts for the rest of the activities, because trying I ended up practically cloning the first layout. My doubt is exclusively on the building/writing of the layouts for the other activities. Would have comented there, but my reputation does not allow me.


Solution

  • Use fragments, make your navigation layout a fragment and place that fragment wherever you need that layout or you can also create a parent activity class in which you implement your navigation layout and extend that activity in rest of your activities.