本文介绍了content_main.xml与activity_main.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将android studio更新为1.4,并注意到现在有一​​个content_main.xmlactivity_main.xml.似乎content_main处理应用程序中的内容,而activity_main处理content_main中的小部件的布局/显示,我不确定这是否正确?还可以让任何人解释为什么用activity_main只处理布局会更好,为什么Google决定进行这种拆分吗?

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?

非常感谢所有帮助.

推荐答案

我将解释它们的用途:

activity_main.xml:

此xml文件用于显示coordinatorLayout,tabLayout,floatingActionButton,viewPager等.

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

content_main.xml:

此xml文件用于显示您的内容,即您要显示给用户的内容.

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

因此,如果您只是问必须将内容放入哪个xml中,content_main.xml就是其中一个

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

这篇关于content_main.xml与activity_main.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 15:39