在我的应用程序中,图像是从服务器加载的。我已经使用图像加载器进行图像加载。但问题是,在加载图像时,如果我滚动 listview ,图像会被打乱,图像的顺序是错误的。但是加载完成后,所有图像都在正确的位置。如果我现在滚动图像不会打乱,它们就在正确的位置。我在 listview中使用过setTag()
and 。请帮助我解决在列表视图中加载图像时图像洗牌的问题。这是我的代码getTag()
getView()
getView()
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View rowView = convertView;
ProgressBar progress;
ImageView image;
ViewHolder view_holder = null;
String m_AllImages=m_BaseImageAll.get(position);
try {
if (rowView == null) {
rowView = inflater.inflate(R.layout.photo_show_sub,
null);
view_holder = new ViewHolder();
view_holder.progress = (ProgressBar) rowView.findViewById(R.id.photoGalProgress);
view_holder.image = (ImageView) rowView.findViewById(R.id.image);
}
else
{
view_holder = (ViewHolder) rowView.getTag();
}
imageLoader.displayImage(m_AllImages,
activity, view_holder.image, view_holder.progress);
} catch (Exception ex) {
ex.printStackTrace();
}
return rowView;
}