gpt4 book ai didi

android - 第一个适配器图像不正确

转载 作者:太空狗 更新时间:2023-10-29 13:39:38 25 4
gpt4 key购买 nike

出于某种原因,我的第一张图片显示正确,然后被另一个用户的图片覆盖。任何想法:

public View getView(int position, View convertView, ViewGroup parent) { 
View vi=convertView;
ViewHolder holder;
if( convertView == null ){
vi = inflater.inflate(R.layout.feed_item, null);
holder=new ViewHolder();
holder.userImage = (ImageView) vi.findViewById(R.id.feed_userimage);
vi.setTag(holder);
} else {
holder=(ViewHolder)vi.getTag();
}
if(user.has("image") &&
user.getString("image") != null &&
!user.getString("image").equals("null")) {
holder.userImage.setTag(user.getString("image"));
imageLoader.DisplayImage(user.getString("image"), act, holder.userImage,USER_IMAGE_SIZE);
} else {
holder.userImage.setImageDrawable(null);
}

最佳答案

试试这个修复

if(user.has("image") && 
user.getString("image") != null &&
!user.getString("image").equals("null")) {
holder.userImage.setTag(user.getString("image"));
imageLoader.DisplayImage(user.getString("image"), act, holder.userImage,USER_IMAGE_SIZE);
} else {
holder.userImage.setTag(null);//add this line
holder.userImage.setImageDrawable(null);
}

关于android - 第一个适配器图像不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7392960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com