自定义控件 LayoutInflater
控件就是Button、Image、 ImageButton之类的东西
LayoutInflater 所谓“扩展”,
作用类似于findViewById(),
不同的是LayoutInflater是用来获得View的,
即返回值就是View ,
而findViewById()是用来获得具体控件的
如:
View itemview
= LayoutInflater.from(context).inflate(布局文件中的控件id, parent, false);
用法
第 一种
View itemview = LayoutInflater.from(context).inflate(layoutid, parent, false);
第二种
View itemview = LayoutInflater.from(context).inflate(layoutid, parent, false);
第三种
View itemview = LayoutInflater.from(context).inflate(layoutid, parent, false);
代码摘自http://blog.csdn.net/zuolongsnail/article/details/6370035