【问题标题】:Android Picasso How to perform action when placeholder transition into imageAndroid Picasso 如何在占位符转换为图像时执行操作
【发布时间】:2015-09-01 13:03:28
【问题描述】:

我在我的应用程序中使用 Picasso 将图像从 url 加载到图像视图中。我想执行一个操作,但仅在图像到达后才执行,而不是在加载占位符可见时执行。

我如何做到这一点?

谢谢!

【问题讨论】:

  • 问清楚,你想做什么,什么时候做

标签: android imageview picasso


【解决方案1】:

你可以如下使用毕加索的回调

Picasso.with(getContext())
    .load(url)
    .into(imageView, new com.squareup.picasso.Callback() {
                        @Override
                        public void onSuccess() {
                              // do something if its loaded successfully
                        }

                        @Override
                        public void onError() {
                             // do something if its not loaded successfully
                        }
                    });

【讨论】:

  • 完美运行。谢谢!
【解决方案2】:

使用 Picasso into methodcallback 并在调用 onSuccess() 时执行您的代码。

【讨论】:

    猜你喜欢
    • 2015-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-17
    • 2016-07-18
    • 2020-12-08
    • 2016-09-03
    相关资源
    最近更新 更多