参考连接:http://blog.csdn.net/lovexieyuan520/article/details/9036673

http://www.2cto.com/kf/201407/313054.html

http://blog.csdn.net/xyz_fly/article/details/37932989

http://blog.jobbole.com/72156/

inflate方法有4种:这个方法重载了四种调用方式,分别为:

1. public View inflate(int resource, ViewGroup root)

2. public View inflate(int resource, ViewGroup root, boolean attachToRoot)

3.public View inflate(XmlPullParser parser, ViewGroup root)

4.public View inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot)

最终调用第四种方法。

1当root为空,当前布局不起作用,使用根布局的设置。

2当root不为空(root),attachToRoot为false,才能使用该布局的设置。 当attachToRoot为true,该布局被添加到(如果根布局为垂直排列)(挂载?)根布局中,且保留了其自己的layoutparam参数(即该布局的参数设置)。

某1楼总结:

true:并且root存在,将xml挂载到root下,返回root
false:返回xml的跟布局

LayoutInflater.inflate() 参数研究的更多相关文章

  1. android LayoutInflater.inflate()的参数介绍

    LayoutInflater.inflate()的作用就是将一个xml定义的布局文件实例化为view控件对象: 与findViewById区别: LayoutInflater.inflate是加载一个 ...

  2. 6、Android之LayoutInflater.inflate()

    LayoutInflater.inflate()的作用就是将一个xml定义的布局文件实例化为view控件对象: 与findViewById区别: LayoutInflater.inflate是加载一个 ...

  3. Android LayoutInflater.inflate使用上的问题解惑

    最近在在使用LayoutInflater.inflate方法时遇到了一些问题,以前没有仔细看过此类的使用方法,故将其记录下来,方便日后查阅. 相信大家都知道LayoutInflater.inflate ...

  4. [Xamarin] 使用LayoutInflater.Inflate載入預先設計好的Layout並使用 (转帖)

    開發的時候,一定會把一些東西設計成元件,並且可以多次使用,今天紀錄一篇比較簡單的方法,可以載入事先做好的Layout 並且給予事件 介紹一下範例: Main.axml: <?xml versio ...

  5. setContentView()与LayoutInflater.inflate()作用

    @Override protected void onCreate(Bundle savedInstanceState) {  try{   super.onCreate(savedInstanceS ...

  6. Android LayoutInflater.inflate(int resource, ViewGroup root, boolean attachToRoot)的参数理解

    方法inflate(int resource, ViewGroup root, boolean attachToRoot) 中 第一个参数传入布局的资源ID,生成fragment视图,第二个参数是视图 ...

  7. Android LayoutInflater.inflate()的参数及其用法

    很多人在网上问LayoutInflater类的用法,以及inflate()方法参数的含义,现解释如下: inflate()的作用就是将一个用xml定义的布局文件查找出来,注意与findViewById ...

  8. LayoutInflater.inflate()方法两个参数和三个参数

    转载请标明出处:https://www.cnblogs.com/tangZH/p/7074853.html  很多人都用过LayoutInflater(布局填充器) 对于我来说通常使用下面两种:Lay ...

  9. View inflate方法和LayoutInflater inflate方法的区别详解

    原创文章,转载请注明出处:http://www.cnblogs.com/baipengzhan/p/6257510.html 我们在Android开发中,对于将布局填充成View对象,最常用的两种办法 ...

随机推荐

  1. bootstrap瀑布流代码

    <extend name="Base/common" /> <block name="search-cate"> <include ...

  2. angularJS快速入门

    1.引入脚本文件 <link rel="stylesheet" href="http://lib.sinaapp.com/js/bootstrap/v3.0.0/c ...

  3. POJ1700:Crossing River(过河问题)

    POJ1700 题目链接:http://poj.org/problem?id=1700 Time Limit:1000MS     Memory Limit:10000KB     64bit IO ...

  4. Keil使用中的若干问题

    一.混合编程 1.模块内接口: 使用如下标志符: #pragma asm 汇编语句 #pragma endasm 注意:如果在c51程序中使用了汇编语言,注意在keil编译器中需要激活Properti ...

  5. WebSocket 支持的浏览器

    http://caniuse.com/#feat=websockets

  6. Android的5个进程等级(转)

    1.foreground process     正处于activity resume状态     正处于bound服务交互的状态     正处于服务在前台运行的状态(StartForeGround( ...

  7. POJ1008 1013 1207 2105 2499(全部水题)

    做了一天水题,挑几个还算凑合的发上来. POJ1008 Maya Calendar 分析: #include <iostream> #include <cstdio> #inc ...

  8. COJ 0342 逆序对(一)

    传送门:http://oj.cnuschool.org.cn/oj/home/problem.htm?problemID=312 试题描述: 给你一个大小为N的int数组A.请你统计有多少数对(Ai, ...

  9. BZOJ1782: [Usaco2010 Feb]slowdown 慢慢游

    1782: [Usaco2010 Feb]slowdown 慢慢游 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 541  Solved: 326[Sub ...

  10. winPcap_4_获取已安装设备的高级信息

    由 pcap_findalldevs_ex() 返回的每一个 pcap_if 结构体,都包含一个 pcap_addr 结构体,这个结构体由如下元素组成: 一个地址列表 一个掩码列表 (each of ...