android中LayoutInflater的使用
2014-09-25 13:28
218 查看
Inflater英文意思是膨胀,在Android中应该是扩展的意思吧。
LayoutInflater 的作用类似于
findViewById(),不同点是LayoutInflater是用来找layout文件夹下的xml布局文件,并且实例化!而
findViewById()是找具体某一个xml下的具体 widget控件(如:Button,TextView等)。
java代码:
view plaincopy to clipboardprint?
LayoutInflater inflater = LayoutInflater.from(this);
View view=inflater.inflate(R.layout.ID, null);
或者干脆并成一句:
View view=LayoutInflater.from(this).inflate(R.layout.ID, null);
LayoutInflater 的作用类似于
findViewById(),不同点是LayoutInflater是用来找layout文件夹下的xml布局文件,并且实例化!而
findViewById()是找具体某一个xml下的具体 widget控件(如:Button,TextView等)。
java代码:
view plaincopy to clipboardprint?
LayoutInflater inflater = LayoutInflater.from(this);
View view=inflater.inflate(R.layout.ID, null);
或者干脆并成一句:
View view=LayoutInflater.from(this).inflate(R.layout.ID, null);
相关文章推荐
- Android高手进阶教程(五)之----Android 中LayoutInflater的使用!
- Android 中LayoutInflater的使用!
- Android高手进阶教程(五)之----Android 中LayoutInflater的使用!
- android 入门学习笔记 LayoutInflater的使用
- android中LayoutInflater的使用
- android中LayoutInflater的使用
- Android中利用LayoutInflater使用Dialog
- Android 中LayoutInflater的使用
- 【转】Android 中LayoutInflater的使用
- android中LayoutInflater的使用
- android LayoutInflater的使用
- Android高手进阶教程(五)之 ----Android 中LayoutInflater的使用
- Android高手进阶教程(五)之----Android 中LayoutInflater的使用!
- Android 中LayoutInflater的使用
- Android高手进阶教程(五)之----Android 中LayoutInflater的使用!
- android中LayoutInflater的使用
- Android高手进阶教程(五)之----Android 中LayoutInflater的使用!
- Android中LayoutInflater的使用 更新中....
- Android高手进阶教程(五)之----Android 中LayoutInflater的使用! (转)
- Android高手进阶教程(五)之----Android 中LayoutInflater的使用!