当我在 customadapter 中将 Picasso 用于列表视图图像时,当向下和向后滚动到上一个位置列表视图时,我的图像混合了其他位置项目
when i using Picasso in customadapter for listview image, when scroll down and back previous place listview, my image mix other position items
当使用Picasso库下载图片并在listview的imageview中打印时,我对listview图片使用了BaseAdapter。当我向下和向后滚动到上一个位置列表视图时,我的图像混合了其他位置项目列表视图
我的适配器代码:
public View getView(final int position, View view, ViewGroup parent) {
final ViewHolder holder;
if (view == null) {
holder = new ViewHolder();
view = inflater.inflate(R.layout.search_items, null);
holder.NoeMelk = (TextView) view.findViewById(R.id.TxtNoeMelk);
holder.Imgmelk = (ImageView) view.findViewById(R.id.Imgmelk);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
// Set the results into TextViews
holder.Code.setText(worldParametrs.get(position).getId());
if (!worldParametrs.get(position).getPic1().equals("") ) {
String picurl1 = "http://ansari-rs.ir/public/image/home/" + worldParametrs.get(position).getId() + "/" + worldParametrs.get(position).getPic1();
Picasso.with(mContext).load(picurl1).resize(80, 110).into(holder.Imgmelk);
Log.e("FOG", "http://ansari-rs.ir/public/image/home/" + worldParametrs.get(position).getId() + "/" + worldParametrs.get(position).getPic1());
picurl1 = "";
}
return view;
}
您需要为
添加其他内容
if (!worldParametrs.get(position).getPic1().equals("") ) {
//your code
} else {
holder.Imgmelk.setDrawable(null)
}
当使用Picasso库下载图片并在listview的imageview中打印时,我对listview图片使用了BaseAdapter。当我向下和向后滚动到上一个位置列表视图时,我的图像混合了其他位置项目列表视图
我的适配器代码:
public View getView(final int position, View view, ViewGroup parent) {
final ViewHolder holder;
if (view == null) {
holder = new ViewHolder();
view = inflater.inflate(R.layout.search_items, null);
holder.NoeMelk = (TextView) view.findViewById(R.id.TxtNoeMelk);
holder.Imgmelk = (ImageView) view.findViewById(R.id.Imgmelk);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
// Set the results into TextViews
holder.Code.setText(worldParametrs.get(position).getId());
if (!worldParametrs.get(position).getPic1().equals("") ) {
String picurl1 = "http://ansari-rs.ir/public/image/home/" + worldParametrs.get(position).getId() + "/" + worldParametrs.get(position).getPic1();
Picasso.with(mContext).load(picurl1).resize(80, 110).into(holder.Imgmelk);
Log.e("FOG", "http://ansari-rs.ir/public/image/home/" + worldParametrs.get(position).getId() + "/" + worldParametrs.get(position).getPic1());
picurl1 = "";
}
return view;
}
您需要为
添加其他内容if (!worldParametrs.get(position).getPic1().equals("") ) {
//your code
} else {
holder.Imgmelk.setDrawable(null)
}