inflater.inflate()的参数含义

inflate()的作用就是将一个用xml定义的布局文件查找出来,注意与findViewById()的区别,inflate是加载一个布局文件,而findViewById则是从布局文件中查找一个控件。

1.获取LayoutInflater对象有三种方法

LayoutInflater inflater=LayoutInflater.from(this);
LayoutInflater inflater=getLayoutInflater();
LayoutInflater inflater=(LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);

2.关于LayoutInflater类inflate(int resource, ViewGroup root, boolean attachToRoot)方法三个参数的含义

resource:需要加载布局文件的id,意思是需要将这个布局文件中加载到Activity中来操作。

root:需要附加到resource资源文件的根控件,什么意思呢,就是inflate()会返回一个View对象,如果第三个参数attachToRoot为true,就将这个root作为根对象返回,否则仅仅将这个root对象的LayoutParams属性附加到resource对象的根布局对象上,也就是布局文件resource的最外层的View上,比如是一个LinearLayout或者其它的Layout对象。

attachToRoot:是否将root附加到布局文件的根视图上

时间: 2024-08-06 08:11:11

inflater.inflate()的参数含义的相关文章

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

很多人在网上问LayoutInflater类的用法,以及inflate()方法参数的含义,现解释如下: inflate()的作用就是将一个用xml定义的布局文件查找出来,注意与findViewById()的区别,inflate是加载一个布局文件,而findViewById则是从布局文件中查找一个控件. 1.获取LayoutInflater对象有三种方法 LayoutInflater inflater=LayoutInflater.from(this); LayoutInflater inflat

android LayoutInflater.inflate()的参数介绍

LayoutInflater.inflate()的作用就是将一个xml定义的布局文件实例化为view控件对象: 与findViewById区别: LayoutInflater.inflate是加载一个布局文件: findViewById则是从布局文件中查找一个控件: 一.获取LayoutInflater对象有三种方法 LayoutInflater inflater=LayoutInflater.from(context); LayoutInflater inflater=getLayoutInf

802.11学习笔记1-WIFI参数含义

研究下wifi参数的含义 #The word of "Default" must not be removed Default CountryRegion=5 CountryRegionABand=7 CountryCode= SSID=Dennis2860AP NetworkType=Infra WirelessMode=9 Channel=0 BeaconPeriod=100 TxPower=100 BGProtection=0 TxPreamble=0 RTSThreshold=

jQuery中Ajax事件beforesend及各参数含义

jQuery中Ajax事件beforesend及各参数含义 2014-01-21 22:27 1678人阅读 评论(0) 收藏 举报  分类: jquery(36)  转自:http://blog.sina.com.cn/s/blog_609f9fdd0100wprz.html Ajax会触发很多事件. 有两种事件,一种是局部事件,一种是全局事件: 局部事件:通过$.ajax来调用并且分配. $.ajax({ beforeSend: function(){ // Handle the befor

Mysqldump参数大全 这 些参数 不同于 mysql 的那些参数(下边文章开头有链接) :2 种类型的参数含义是不一样的

Mysqldump参数大全  这 些参数 不同于 mysql 的那些参数  :2 种类型的参数含义是不一样的 Mysqldump参数大全(参数来源于mysql5.5.19源码) 参数 参数说明 --all-databases , -A 导出全部数据库. mysqldump -uroot -p --all-databases --all-tablespaces , -Y 导出全部表空间. mysqldump -uroot -p --all-databases --all-tablespaces -

php编译参数选项 具体参数含义可以用./configure --help来查看

php编译参数选项 PHP_INSTALL_PATH=/data/web/php MYSQL_INSTALL_PATH=/data/web/mysql ./configure --prefix=${PHP_INSTALL_PATH} --with-config-file-path=${PHP_INSTALL_PATH}/etc --with-mysql=${MYSQL_INSTALL_PATH} --with-mysqli=${MYSQL_INSTALL_PATH}/bin/mysql_conf

mysql命令行参数 --- 这些参数不同于 mysqldump 后的 那些参数(下边文章开头有链接) :2种类型的参数 含义是不一样的

mysql命令行参数  --- 这些参数不同于  mysqldump  后的 那些参数   :2种类型的参数 含义是不一样的 一,mysql命令行参数 Usage: mysql [OPTIONS] [database] //命令方式 -?, --help //显示帮助信息并退出 -I, --help //显示帮助信息并退出 --auto-rehash //自动补全功能,就像linux里面,按Tab键出提示差不多,下面有例子 -A, --no-auto-rehash //默认状态是没有自动补全功能

AdapterView<?> arg0, View arg1, int arg2, long arg3参数含义

arg0:是指父Vjew arg1就是你点击的那个Item的View arg2是position,position是你适配器里面的position arg3是id,一般是第几个项,id是哪个项View的id. AdapterView<?> arg0, View arg1, int arg2, long arg3参数含义

百度搜索URL参数含义

百度搜索URL参数含义 (2014-08-19 15:46:13) 转载▼   分类: Android开发 http://blog.csdn.net/followingturing/article/details/7850317 http://www.baidu.com/s?wd=justin&rsv_spt=1&issp=1&rsv_bp=0&ie=utf-8&tn=baiduhome_pg&rsv_sug3=6&rsv_sug9=eb&r