文件名称:ListView控件
文件大小:2.64MB
文件格式:ZIP
更新时间:2018-01-17 14:54:03
ListView 局部刷新 刷新
实现 ListView 局部刷新 刷新 public View getView(int position, View convertView, ViewGroup parent) { ViewHold viewHold = null; final int position1 = position; if(null == convertView){ viewHold = new ViewHold(); convertView = layoutInflater.inflate(R.layout.item_title, null); viewHold.imagView = (ImageView) convertView.findViewById(R.id.image); viewHold.text = (TextView) convertView.findViewById(R.id.tv_1); viewHold.button = (Button) convertView.findViewById(R.id.button); convertView.setTag(viewHold); }else { viewHold = (ViewHold)convertView.getTag(); } final Image image = datalist.get(position); viewHold.text.setText(image.image_tite); viewHold.imagView.setBackgroundResource(image.image); viewHold.button.setText(image.button_title); viewHold.button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { image.image = R.drawable.img2; image.button_title = "img2"; image.image_tite = "image2"; updateView(position1); } }); return convertView; }