我在持有者中有一个列表视图,我想隐藏holder.start textview当我点击相同的textview并看到holder.stop textview时,如果我执行以下代码,它会隐藏最后一个列表视图位置请帮忙做这个
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView =setViewIdToHolder(convertView,parent,position);
}
//populate vive method
populateView(position, convertView);
BookedUserObject booked = this.getItem(position);
Animation animation = null;
animation = new ScaleAnimation(1.0f, 1.0f, 0.5f, 1.0f);
animation.setInterpolator(new OvershootInterpolator());
animation.setDuration(600);
convertView.startAnimation(animation);
return convertView;
}
//link here
private void populateView(int position, View convertView) {
final ViewHolder holder = (ViewHolder) convertView.getTag();
BookedUserObject booked_obj = this.getItem(position);
holder.name.setText(booked_obj.getName());
holder.source.setText(booked_obj.getSource());
holder.destination.setText(booked_obj.getDestination());
holder.start.setTag(position);
holder.stop.setTag(position);
}
private View setViewIdToHolder(View rowView, ViewGroup parent,int position) {
rowView = ((Activity) this.getContext()).getLayoutInflater().inflate(R.layout.match_booked_user_list, parent, false);
holder = new ViewHolder();
holder.name = (TextView) rowView.findViewById(R.id.name);
holder.source = (TextView) rowView.findViewById(R.id.source);
holder.destination = (TextView) rowView.findViewById(R.id.destination);
holder.start = (TextView) rowView.findViewById(R.id.start);
holder.stop = (TextView) rowView.findViewById(R.id.stop);
holder.start.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {`enter code here`
final int position = (Integer) view.getTag();
start(position);
//IF I DO THIS THIS HIDES THE LAST LISTVIEW POSITION TEXTVIEW
holder.start.setVisibility(View.INVISIBLE);
}
});
}