Answer the question
In order to leave comments, you need to log in
How to properly include layouts in an android application?
Here I have a drawlerLayout inside it includes @layout/app_bar inside app_bar includes @layout/content_main
So here I click a menu item in this very drawer and I want something else to be included instead of content_main.
How can I do it ?
I can use
setContentView();
but then I'll have to duplicate @layout/app_bar and the root drawlerLayout, and I'm not completely stupid, I understand that this is bad.
Answer the question
In order to leave comments, you need to log in
Understood nothing. Do you need to organize navigation in an application based on the Navigation Drawer? Then google towards Navigation Drawer.
There are several implementation options, but the most obvious is one host activity with DrawerLayout + Toolbar and menu screens on fragments. To do this, you need to remove the content_main and instead put a FrameLayout and use it as a normal container for the fragment. When a menu is clicked in the Navigation Drawer, the host activity simply changes fragments.
Naturally, each fragment has its own layout.
app_bar_main.xml
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question