LayoutInflater和inflate()方法的使用方法
2014-10-12 20:36
316 查看
public static LayoutInflaterfrom(Context context) {
LayoutInflaterLayoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if(LayoutInflater== null){
thrownew AssertionError("LayoutInflaternot found.");
}
returnLayoutInflater;
}
能够看出它事实上调用context.getSystemService()。
public View inflate(int Resourece,ViewGrouproot)
作用:填充一个新的视图层次结构从指定的XML资源文件里
reSource:View的layout的ID
root: 生成的层次结构的根视图
return 填充的层次结构的根视图。假设參数root提供了,那么root就是根视图;否则填充的XML文件的根就是根视图。
其余几个重载的inflate函数类似。
LayoutInflaterLayoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if(LayoutInflater== null){
thrownew AssertionError("LayoutInflaternot found.");
}
returnLayoutInflater;
}
能够看出它事实上调用context.getSystemService()。
public View inflate(int Resourece,ViewGrouproot)
作用:填充一个新的视图层次结构从指定的XML资源文件里
reSource:View的layout的ID
root: 生成的层次结构的根视图
return 填充的层次结构的根视图。假设參数root提供了,那么root就是根视图;否则填充的XML文件的根就是根视图。
其余几个重载的inflate函数类似。
相关文章推荐
- LayoutInflater.inflate() 使用方法
- LayoutInflater中inflate方法的简单使用
- Android学习之LayoutInflater类和inflate()方法的使用
- android使用LayoutInflater显示进度窗口的方法
- LayoutInflater中四种类型inflate方法的介绍
- LayoutInflater 的inflate(int resource, ViewGroup root, boolean attachToRoot)方法研究
- Android编程之LayoutInflater的inflate方法实例
- 关于LayoutInflater.from(context).inflate()的使用的问题
- LayoutInflater中四种类型inflate方法的介绍
- Android编程之LayoutInflater的inflate方法详解
- LayoutInflater和inflate()方法的用法
- Android layoutinflater inflate()方法
- 【android】LayoutInflater.inflate方法的详解及xml根元素的布局参数不起作用的问题
- LayoutInflater和inflate()方法的用法
- Android编程之LayoutInflater的inflate方法具体解释
- LayoutInflater的作用和使用方法
- LayoutInflater和inflate()方法的用法 .
- LayoutInflater中四种类型inflate方法的介绍
- [Xamarin] 使用LayoutInflater.Inflate載入預先設計好的Layout並使用 (转帖)
- LayoutInflater的inflate方法