public View getView(int position, View convertView, ViewGroup parent) {
View view;
if(convertView==null){
*方法一
view = View.inflate(getApplicationContext(),R.layout.item,null);
*方法二
view =LayoutInflater.from(getApplicationContext()).inflate(R.layout.item,null);
*方法三
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.item, null);
}
else
view=convertView; //控件复用
return view;
}
Android打气筒三种方式
最新推荐文章于 2024-05-03 12:18:28 发布