滑动侦听器不工作

编程入门 行业动态 更新时间:2024-10-24 12:27:38
本文介绍了滑动侦听器不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用Glide加载图片,我添加了一个监听器来知道资源何时准备就绪或者是否有任何类型的错误:

I'm using Glide to load images and I added a listener to know when resource is ready or if there was an error of any type:

Glide.with(mContext) .load(url) .placeholder(R.drawable.glide_placeholder) // use dontAnimate and not crossFade to avoid a bug with custom views .dontAnimate() .diskCacheStrategy(DiskCacheStrategy.ALL) .listener(new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { // do something return true; } @Override public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { // do something return true; } }) .into(mCustomImageView);

应用程序从未在 onResourceReady code> onException 但是如果我删除侦听器并让异步下载没有回调,它运行正确:

The app never runs inside onResourceReady or onException but if I remove the listener and let the async download without a callback, it runs correctly:

Glide.with(mContext) .load(url) .placeholder(R.drawable.glide_placeholder) // use dontAnimate and not crossFade to avoid a bug with custom views .dontAnimate() .diskCacheStrategy(DiskCacheStrategy.ALL) .into(mCustomImageView);

我也尝试使用 GlideDrawableImageViewTarget 接收回调但应用程序在 onLoadStarted 中运行,但从不在 onLoadCleared , onLoadFailed 和 onResourceReady 。

I tried also with GlideDrawableImageViewTarget instead of listener to receive callbacks but app runs inside onLoadStarted but never runs inside onLoadCleared, onLoadFailed and onResourceReady.

推荐答案

如果它看不见或消失,ImageView的可见性的错误。我在这里打开了一个问题: github/bumptech/glide/issues/618

It seems to be a bug with ImageView's visibility if it's invisible or gone. I opened an issue here: github/bumptech/glide/issues/618

更多推荐

滑动侦听器不工作

本文发布于:2023-11-23 03:26:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619909.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:侦听器   工作

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!