实例化为View对象1:
LayoutInflater inflater = (LayoutInflater)context.getSystemService (Context.LAYOUT_INFLATER_SERVICE); LinearLayout layout = (LinearLayout)inflater.inflate(R.layout.list_item,null);实例化为View对象2:
LinearLayout layout = (LinearLayout)LayoutInflater.from(context).inflate
(R.layout.list_item,null);
实例化为View对象3:
LinearLayout layout = (LinearLayout)View.inflate(context,R.layout.list_item,null);实例化为View对象4:
LayoutInflater inflater =getLayoutInflater().inflate(R.layout.list_item,null);
附上参考网址:http://www.2cto.com/kf/201205/131136.html
原文链接:https://www.f2er.com/xml/296818.html