Android Studio中的activity_main.xml和content_main.xml之间的确切区别是什么
在android studio的更新版本中,它会自动创建2个文件
,我阅读了这些文件,但仍然感到困惑,因为两者的工作原理相似,因此,如何确定应该使用哪个文件放东西和代码,我应该在这两个文件中放什么东西?
In an updated version of android studio, it create 2 files
automatically, I read about these files , but am still confused, as both work similarly, So how to decide which one should I use to put the things and code, what are the things I should put in these 2 files ?
这只是一个很酷的概念,其中 content_main.xml
布局仅包含在 activity_main.xml 代码>.因此,您必须将内容放入
content_main.xml
.
This is just a cool concept , where by content_main.xml
layout is just included inside the activity_main.xml
. So you have to put your stuff in content_main.xml
.
使用 activity_main.xml
的本质是在 content_main.xml
布局的顶部插入其他小部件,例如(Floating Action Bar).
The essence of using activity_main.xml
is to insert other widgets such as (Floating Action Bar ) on top of a content_main.xml
layout.
基本上,这种方法只是教会我们如何将 xml
文件包含到其他文件中,而不是使一个 xml 中的多个组件变得拥挤代码>文件.
There for basically , this approach just teaches us on how to include an xml
file into the others , instead of congesting several components in one xml
file.
总而言之,您只需编辑 content_main.xml
布局