【发布时间】:2014-10-12 16:37:40
【问题描述】:
我使用的是 2.3.3,除了我的自定义 ListView 之外,一切似乎都运行良好。大多数时候,毕加索可以完美地加载我的图像,但在少数情况下图像永远不会加载并且微调器继续旋转。此外,有时加载微调器会显示在它后面加载的图像并设置了一些不透明度(目前还没有这个截图,但我会尝试抓取一个)。
这是我在 ArrayAdapter 中加载图像的方式:
Picasso picasso = new Picasso.Builder(getContext()).listener(
new Listener() {
@Override
public void onImageLoadFailed(Picasso arg0,
Uri arg1, Throwable arg2) {
if (Constants.debug) Log.i(LOG_TAG, "imageloadfailed");
arg2.printStackTrace();
}
}).debugging(true).build();
picasso.load(imgUrl).placeholder(R.id.progress).into(h.picture, new Callback() {
@Override
public void onError() {
if (Constants.debug) Log.i(LOG_TAG, "error");
}
@Override
public void onSuccess() {
if (Constants.debug) Log.i(LOG_TAG, "success");
}
});
相关的 XML 部分:
<!-- Image -->
<RelativeLayout
android:id="@+id/plist_image_container"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/progress"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerInParent="true"/>
<ImageView
android:id="@+id/plist_item_thumb"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>
</RelativeLayout>
我永远不会进入 onImageLoadFailed(....),尽管在良好的网络上等待了相当长的时间,但图像永远不会加载。
这是我尝试加载的图像示例: http://res.cloudinary.com/spotlight-images/image/upload/v1408387652/IMG_1408387652509.jpg
编辑: 我最近从 AQuery 切换到 Picasso,AQuery 没有出现这个问题。
【问题讨论】:
-
你解决了这个问题吗?如果你这样做,请发布答案
-
我没有。我最终改用 Volley,一切正常。