毕加索图像加载回调 [英] Picasso image load callback

查看:178
本文介绍了毕加索图像加载回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用毕加索加载在彼此的前三名连续的图像之一列表视图。使用毕加索提供了方法,使这个容易。但是,由于这些图像是在不同的时间在加载它会导致一个闪烁效果的图像进来。例如有时图像2图像出现1日前,当图像1加载它会导致一种不自然的口吃。它会更好,如果我可以设置列表视图的可见性,以无形的,直到所有的图像都可以被显示。然而,没有回调方法,我可以找到毕加索的图像已加载时会发出信号。

I want to use Picasso to load three consecutive images one on top of each other in a listview. Using the methods Picasso provides makes this easy. However because these images are loading in at different times it causes a flickering effect as the images come in. For example sometimes image 2 appears before image 1, and when image 1 loads it causes an unnatural stutter. It would be better if I could set the listview's visibility to invisible until all the images are available to be shown. However, there is no callback method I could find for Picasso that would signal when an image has been loaded.

有谁知道这种情况下用毕加索的解决方案呢?

Does anyone know of a solution for this kind of a situation using Picasso?

感谢

推荐答案

。走进方法提供了一个回调的成功和失败的第二个参数。您可以使用它来跟踪时,所有的三个被称为和行动上的曝光度的一次。

The .into method provides a second argument which is a callback to success and failure. You can use this to keep track of when all three have been called and act on their visibility all at once.

的Javadoc:<一href="http://square.github.io/picasso/javadoc/com/squareup/picasso/RequestCreator.html#into-android.widget.ImageView-com.squareup.picasso.Callback-">http://square.github.io/picasso/javadoc/com/squareup/picasso/RequestCreator.html#into-android.widget.ImageView-com.squareup.picasso.Callback-

这篇关于毕加索图像加载回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆