题目内容
"public class StudentAdapter extends BaseAdapter{private ArrayList students;private LayoutInflaterinflater;…public View getView(int position,View concvertView,ViewGroup root)//加载和复用item界面1.ViewHolder holder = null;2.if(convertView == null){3.convertView = inflater.inflate(R.layout.item,null);4.holder = new ViewHolder();5.holder.tvId = (TextView)convertView.findViewById(R.id.tvId);6.holder.tvName = (TextView)convertView.findViewById(R.id.tvName);7.holder.tvSex = (TextView)convertView.findViewById(R.id.tvSex);8.holder.tvAge = (TextView)convertView.findViewById(R.id.tvAge);9.convertView.setTag(holder);10.}else{11.holder = convertView.getTag();12.}13.//根据position从集合中获取数据14.Student stu = students.get(position);15.//将数据写入到item中16.holder.tvId.setText(stu.getId());17. holder.tvName.setText(stu.getName());18. holder.tvSex.setText(stu.getSex());19. holder.tvAge.setText(stu.getAge());20. //返回该item界面|21. return convertView;}class ViewHolder{private TextViewtvId;private TextViewtvName;private TextViewtvSex;private TextViewtvAge;}}关于上述代码,下列说法错误的是()。"
查看答案
搜索结果不匹配?点我反馈