Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

content_main.xml vs activity_main.xml

I have recently updated android studio to 1.4 and noticed that there is now a content_main.xml and an activity_main.xml. It seems that content_main deals with what goes into the app and activity_main deals with the layout/display of the widgets from content_main, I am not sure whether this is correct? Also would it be possible for anyone to explain why having activity_main deal with just the layout is better and why Google decided to do this split?

All help is much appreciated.

like image 845
Hamid Avatar asked May 20 '26 16:05

Hamid


1 Answers

I'll explain what they are for:

activity_main.xml:

this xml file is used to display coordinatorLayout,tabLayout,floatingActionButton,viewPager etc. etc.

content_main.xml:

This xml file is use to display your stuff i.e. what you want to display to users.

So, if you are just asking in which xml you have to put your stuff, content_main.xml is the one

like image 149
RITESH KUMAR Avatar answered May 23 '26 06:05

RITESH KUMAR