我将照片保存在服务器中,并将其显示在我的应用中的其他位置,但图像不会显示在imageview中,当我制作log.e时,图片网址的网址是正确的,所以我不知道为什么图像没有出现在imageview任何帮助????
public CustListMis(Activity context, ArrayList<String> NameArray, ArrayList<String> quantityArray, ArrayList<String> durationArray, ArrayList<String> dTimeArray, ArrayList<String> Images) {
super(context, R.layout.temp_mis, quantityArray);
this.context = context;
this.NameArray = NameArray;
this.quantityArray = quantityArray;
this.durationArray = durationArray;
this.dTimeArray= dTimeArray;
this.Images = Images;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View listViewItem = inflater.inflate(R.layout.temp_mis, null, true);
TextView name = (TextView) listViewItem.findViewById(R.id.name);
TextView quantity = (TextView) listViewItem.findViewById(R.id.quantity);
TextView duration = (TextView) listViewItem.findViewById(R.id.duration);
TextView dTime = (TextView) listViewItem.findViewById(R.id.dTime);
ImageView myUploadImage = (ImageView)listViewItem.findViewById(R.id.imageyy);
String url = Images.get(position);
// String url = "http://sae-marketing.com/gamaia/PHOTOS/dream.age25@gmail.com-554806.png";
Log.e("image",url);
Picasso.with(context).load(url).noFade().resize(50, 50).centerCrop().into(myUploadImage);
name.setText(NameArray.get(position));
quantity.setText(quantityArray.get(position));
duration.setText(durationArray.get(position));
dTime.setText(dTimeArray.get(position));
return listViewItem;
}
答案 0 :(得分:1)
在OP评论之后,我们最终得出问题确实存在于String url
变量中,该变量不包含有效的URL字符串(缺少http://
)。
所以解决方案就这样做了:
//String url = "http://sae-marketing.com/gamaia/PHOTOS/dream.age25@gmail.com-554806.png";
String url = "http://" + Images.get(position);
ImageView iv = findViewById(R.id.imageView);
Picasso.with(this).load(url).into(iv);
答案 1 :(得分:0)
你可以使用
开启毕加索的日志Picasso.with(Context).setLoggingEnabled(true)
您可能会看到一条错误消息,其中包含
的原因