content_main.xml和activity_main.xml之间的区别? [英] Difference between content_main.xml and activity_main.xml?

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

问题描述

我是Android App开发的新手.我有Android Studio 1.4.在我的布局文件夹中,我有两个XML文件(content_main.xmlactivity_main.xml).我一直在关注Bucky的教程,而他只有activity_main.xml.我应该使用哪一个?

I am new to Android App development. I have Android Studio 1.4. In my layout folder I have two XML files (content_main.xml and activity_main.xml). I have been following Bucky's tutorial and he just has the activity_main.xml. Which one should I use?

推荐答案

与以前的版本不同,新的API 23附带了coordinatorLayout和其他内容,为了使它们易于使用,android将活动的布局区分为两种不同的布局即content_main.xml& activity_main.xml.

Unlike previous version, the new API 23 comes with the coordinatorLayout and stuff and just to make them simple to use android has distinguished activity's layout into two different layout i.e. content_main.xml & activity_main.xml.

我将解释它们的用途:

  1. activity_main.xml

此xml文件用于显示coordinatorLayouttabLayoutfloatingActionButtonviewPager等.

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

  1. 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之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆