图像切换器幻灯片动画在使用滑动加载时不起作用



使用滑行加载时,ImageSwitcher幻灯片动画不起作用。

imageSwitcher.setInAnimation(In);
imageSwitcher.setOutAnimation(Out);
Glide
     .with(getActivity())
     .load(imageURL)
     .into((ImageView) imageSwitcher.getCurrentView());

当从本地资源加载图像而不滑动时,此动画工作正常

imageSwitcher.setImageResource(data.get(position).getImage_drawable());

就这样用它:

Glide.with(view.context)
            .asDrawable()
            .load(url)
            .listener(object : RequestListener<Drawable> {
                override fun onLoadFailed(
                    e: GlideException?,
                    model: Any?,
                    target: Target<Drawable>?,
                    isFirstResource: Boolean
                ) = false
                override fun onResourceReady(
                    resource: Drawable?,
                    model: Any?,
                    target: Target<Drawable>?,
                    dataSource: DataSource?,
                    isFirstResource: Boolean
                ): Boolean {
                    (view.nextView as? ImageView)?.setImageDrawable(resource)
                    view.showNext()
                    return true
                }
            })
            .submit()

相关内容

  • 没有找到相关文章

最新更新