Android Studio 中的 Acitvity_Main.xml 和 Fragment_main.xml 文件有什么区别 [英] What is the difference between Acitvity_Main.xml and Fragment_main.xml files in Android Studio

查看:25
本文介绍了Android Studio 中的 Acitvity_Main.xml 和 Fragment_main.xml 文件有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我创建一个新项目时,Fragment_main.xml 文件都会添加到我的 Layout 文件夹中,与 Eclipse 不同的是,这个文件包含通常在 Activity_Main.xml 文件中的内容.为什么 Fragment_main.xml 文件总是添加到我在 Android Studio 中的项目中,它与常规"Activity_main.xml 文件有何不同?

When ever i create a new project, the Fragment_main.xml file is added to my Layout folder and unlike in Eclipse it is this file that contains what is normally in the Activity_Main.xml file.Why is the Fragment_main.xml file always added to my projects in Android Studio and how is it different from the "regular" Activity_main.xml file?

推荐答案

Activity_main.xml 包含 FragmentActivity 的 Layout,fragment_main.xml 是 Fragment 的 Layout.

The Activity_main.xml contains the Layout for the FragmentActivity and the fragment_main.xml is the Layout for the fragment.

有关片段的更多信息以及如何使用它.
访问:http://developer.android.com/training/basics/fragments/index.html

For more information to fragments and how you can use it.
Visit: http://developer.android.com/training/basics/fragments/index.html

这篇关于Android Studio 中的 Acitvity_Main.xml 和 Fragment_main.xml 文件有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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