【发布时间】:2020-01-07 05:24:59
【问题描述】:
我正在使用 glide 从服务器图像加载图像,它突然显示而没有任何动画。我需要显示带有渐变动画的图像,请给我一些建议。
【问题讨论】:
标签: android android-recyclerview android-animation android-glide
我正在使用 glide 从服务器图像加载图像,它突然显示而没有任何动画。我需要显示带有渐变动画的图像,请给我一些建议。
【问题讨论】:
标签: android android-recyclerview android-animation android-glide
您必须在 GLIDE 构建器调用中使用 transitions() API。您可以通过以下 2 种方法来实现这一目标。
1) 通过使用转换 API:Official Documentation
GlideApp
.with(context)
.load(....)
.transition(DrawableTransitionOptions.withCrossFade()) //Here a fading animation
.into(....);
2) 通过创建TransitionFactory : SOF Answer by user tudor
GlideApp.with(this)
.load(url)
.transition(DrawableTransitionOptions.with(Your_custom_factory))
.into(image)
希望对你有帮助
【讨论】: