我在我的应用中创建了 Facebook 群组时间线。我在 FB 组中有帖子,我将它们设置在 Android 的列表视图中,但是当我滚动列表视图时,我在列表项中丢失了第二张图片。我已经复制了我的图像加载器类,但没有任何改变。
滚动前
滚动后
这是我的适配器 getView 方法:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
ViewHolder holder;
if (convertView == null) {
vi = inflater.inflate(R.layout.announce_item, null);
holder = new ViewHolder();
holder.textTitle = (TextView) vi.findViewById(R.id.textView1);
holder.image = (ImageView) vi.findViewById(R.id.imageView1);
holder.attachimage=(ImageView)vi.findViewById(R.id.attachimage);
holder.contentArea = (TextView) vi.findViewById(R.id.textView2);
vi.setTag(holder);
} else
holder = (ViewHolder) vi.getTag();
holder.textTitle.setText(sender.get(position));
String content = contentMessage.get(position);
holder.contentArea.setText(Html.fromHtml(content.replace("\n", "<br/>")+" "+type.get(position)));
holder.image.setTag(profilePicture.get(position));
imageLoader.DisplayImage(profilePicture.get(position), activity,
holder.image);
if(type.get(position).equals("photo"))
{
holder.attachimage.setTag(attach.get(position));
imageLoader3.DisplayImage(attach.get(position),activity,holder.attachimage);
System.out.println("To Loader: "+attach.get(position));
}
else
{
holder.attachimage.setVisibility(View.GONE);
}
return vi;
}