Android Studio项目中的MainActivity.xml与ContentActivity.xml
来源:互联网 发布:怎么做淘宝返利链接 编辑:程序博客网 时间:2024/06/16 22:06
最近比较闲,买了本《Android疯狂讲义(第三版)》开始自学Android应用的开发。书中介绍的默认布局文件是MainActivity.xml,而在Android Studio中新建project后,在Layout文件中会生成两个xml文件,分别是MainActivity.xml和ContentActivity.xml,而书中所描述的、等标签也是位于Content.xml文件中的。于是去Google了一下两个xml文件的关系:
According to new design pattern in android studio activity_main.xml will determine how the look of the main activity should be. And on the other hand content_main.xml will determine the contents in the activity_main.xml. That is content_main.xml will contain the textview, edittext, button etc component. And the content_main.xml will be included by the activity_main.xml .
So we can think of content_main.xml just like partial in HTML. activity_main.xml will contain your activity global design, and content_main.xml the contents.
http://stackoverflow.com/questions/32880722/what-is-the-role-of-content-main-xml-in-android-studio-1-4
也就是说,MainActivity用于显示coordinatorLayout,tabLayout,floatingActionButton,viewPager等控件;而ContentActivity用于显示你自己的控件,TextView,ImageView等等。新版的界面设计思路即把用户控件从系统控件中独立出来,分别管理,最后再从MainActivity中include ContentActivity文件。
个人理解,仅供参考。
- Android Studio项目中的MainActivity.xml与ContentActivity.xml
- Android studio 调用Assets中的xml文件
- MainActivity 访问 fragment_main.xml 中的组件 空指针
- Android开发,Eclipse未自动创建MainActivity及main.xml?
- Android开发,Eclipse未自动创建MainActivity及main.xml?
- yuekao=xml=mainactivity
- android 项目中的lint.xml文件
- Android-项目中的XML协议封装
- Android Studio xml preview
- android studio XML颜色
- Android studio 的项目目录+AndroidManifes.xml权限
- Android中的XML解析与生成
- Android中的Xml文件与解析简介
- android中的资源,资源与xml文件
- android Studio将String.xml中的字段导出。
- 关于Android Studio中的AndroidManifest.xml文件的解读
- 4.1 Android Studio中的AndroidManifest.xml文件分析
- Android Studio 字符串 string.xml
- 矩阵的旋转 2559 SDUT
- 一、学习笔记之OpenCv的相关函数
- php聊天室
- RPC的过程详解
- linux C 读取 /etc/passwd 和 /etc/shadow 文件 API
- Android Studio项目中的MainActivity.xml与ContentActivity.xml
- APP开发流程
- 303,Range Sum Query
- 《笨办法学Python》 第0课手记
- MySQL性能优化的最佳20+条经验
- 乡 恋
- 2016年梅花 迎春花
- Objective-C学习日志3
- mini2440_sdram寻址分析