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 LayoutInflater实例化的方法)