gpt4 book ai didi

android - 如何使用 Android-Volley 设置动画图像直到图像加载

转载 作者:太空狗 更新时间:2023-10-29 16:41:20 26 4
gpt4 key购买 nike

在 android volley 中,我知道在 NetwrokImageView 中有一个名为 mDefaultImageId 的属性。但这只显示“默认”静止图像。

我需要显示动画图像或进度条。

我知道如果我使用 RequestQueue 就可以做到这一点,但我仍然需要利用 ImageLoader

如何实现?

谢谢。

最佳答案

您可以创建自己的 ImageListener 类实现,并在请求图像时传递它。

类似的东西:

// code for displaying animation / progress wheel

sImageLoader.get(imageUrl, new ImageListener() {

@Override
public void onErrorResponse(VolleyError error) {
// handle errors
}

@Override
public void onResponse(ImageContainer response, boolean isImmediate) {
if (response.getBitmap() != null) {
// code to switch out placeholder animation
// progress wheel with received response
}
}
});

关于android - 如何使用 Android-Volley 设置动画图像直到图像加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17312609/

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