【发布时间】:2014-09-26 15:40:37
【问题描述】:
这是毕加索的代码:
ImageView img = (ImageView)findViewById(R.id.product_image);
Picasso.with(this)
.load(_url)
.fit()
.into(img, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
}
});
这是 _url 的值: http://kiagallery.ir/Images/Upload/Collection%20101/Spring%20101/d4a03b66dc7b46c694615c549b78b2e9.jpg
这是xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/product_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:layout_below="@id/product_image"/>
<TextView
android:id="@+id/product_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:layout_below="@id/product_name"/>
</RelativeLayout>
如您所见,可以通过浏览器访问该图像,但 picasso 无法加载它,我检查了 onError 函数,它从未被调用,我在这里很安静,任何帮助将不胜感激。
编辑:当我给 imageview 的宽度和高度固定值(如 200dp)时,它会加载图像,但当我将其更改为 wrap_content 时,它不会显示图像。
【问题讨论】: