读书人

android LayoutInflater实例化的步骤

发布时间: 2012-12-25 16:18:29 作者: rapoo

android LayoutInflater实例化的方法
在实际开发种LayoutInflater这个类还是非常有用的,它的作用类似于 findViewById(),
不同点是LayoutInflater是用来找layout下xml布局文件,并且实例化!而findViewById()是找具体xml下的具体 widget控件(如:Button,TextView等)。

LayoutInflater inflater = LayoutInflater.from(this); //Obtains the LayoutInflater from the given context.
// LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);

读书人网 >Android

热点推荐