点击ListView 的item中的控件,删除当前item时,想让它一动画的方式 消失,但是,点击删除时,item可以删除掉,但是动画总是执行的最后一行 求解、??
这是主要代码
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(mActivity).inflate(R.layout.layout_dialog_item_detial, null);
holder = new ViewHolder();
holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
holder.tv_score = (TextView) convertView.findViewById(R.id.tv_score);
holder.iv_delete = (ImageView) convertView.findViewById(R.id.iv_delete);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
DiagHistory dh = historyLists.get(position);
holder.tv_time.setText(dh.getScanTime());
holder.tv_score.setText(dh.getDiaScore());
holder.iv_delete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
View itemView = (View) holder.iv_delete.getParent();
removeListItem(itemView, position);
SQLLiteService.getInstance(mActivity).deleteDialogHistory(holder.tv_time.getText().toString().trim());
}
});
return convertView;
}
class ViewHolder {
TextView tv_time, tv_score;
ImageView iv_delete;
}
private void removeListItem(View rowView, final int positon) {
final Animation animation = (Animation) AnimationUtils.loadAnimation(rowView.getContext(),
R.anim.remove_dialog_list_item);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation animation) {
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
historyLists.remove(positon);
DialogItemDetailAdapter.this.notifyDataSetChanged();
animation.cancel();
}
});
rowView.startAnimation(animation);
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。