向下滚动列表视图时错误 [英] listview error when scrolling down

查看:95
本文介绍了向下滚动列表视图时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在列表视图按钮和进度条(看不见的)。当按钮点击它应该会消失,进度栏应该是可见的,并开始运行(从Web服务器下载),当它与运行完按钮应该再次出现。现在,当我点击第一个项目的按钮,进度条运行,但如果我向下滚动,直到第一个项目熄灭屏幕我看到与列表视图的最后一个项目第一个项目的进度条同时运行的进度条。如果我向上滚动的第一个项目的进度正常运行。如果我点击列表视图中的第二个最后一个项目做了同样的第二个项目它发生一样。这是什么问题,我怎么能解决呢?请帮助!

I have button and progress bar(invisible) in listview. When button clicks it should disappear and progress bar should be visible and start running (downloading from web server) and when it is done with running button should appear again. Now when I click first item's button, the progress bar runs but if I scroll down until first item goes off screen I see progress bar running simultaneously with first item's progress bar on last item of listview. If I scroll up the first item's progressbar runs normally. It happens same if I click second item the the second last item of listview does the same. What is the problem and how could I solve it? Please help!!!

推荐答案

只是这个,我这个删除,如果(查看== NULL)更换您的getView你会得到每一次比从其他新的视图标签

just replace your getView with this, i am removing the if(view==null) by this you'll get every time a new view else than from the tag

@Override
public View getView(final int position, View convertView, ViewGroup parent) {   
final ArrayList<String> array=JournalArray.get(position);
final ViewHolder view;
LayoutInflater inflator = activity.getLayoutInflater();

    view = new ViewHolder();
    convertView = inflator.inflate(R.layout.familylist_item, null);
    view.progress=(ProgressBar)convertView.findViewById(R.id.downprogress);
    view.txtViewTitle = (TextView) convertView.findViewById(R.id.text);
    view.imgViewFlag = (ImageView) convertView.findViewById(R.id.imageView1);
    view.imgAR=(Button)convertView.findViewById(R.id.imageAR);
    view.imgAR.setTag(view);
    view.imgDown=(Button)convertView.findViewById(R.id.imageDown);
    view.imgDown.setTag(view);
    view.imgPDF=(Button)convertView.findViewById(R.id.imagePDF);
    view.imgPDF.setTag(view);
    view.progress=(ProgressBar)convertView.findViewById(R.id.downprogress);
    view.btnDel=(Button)convertView.findViewById(R.id.btnDel);
    view.btnDel.setTag(view);
    convertView.setTag(view);
}

这篇关于向下滚动列表视图时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆