Glide with Animation 如何加载图片
How do load images in Glide with Animation
我正在使用 glide 从服务器图像加载图像,它突然显示没有任何动画。我需要显示带有淡入淡出动画的图像,请给我一些建议。
您必须在 GLIDE 构建器调用中使用 transitions()
API。这里有 2 种可能的方法可以实现这一点。
1) 通过使用转换 API : Official Documentation
GlideApp
.with(context)
.load(....)
.transition(DrawableTransitionOptions.withCrossFade()) //Here a fading animation
.into(....);
2) 通过创建一个 TransitionFactory
: by user tudor
GlideApp.with(this)
.load(url)
.transition(DrawableTransitionOptions.with(Your_custom_factory))
.into(image)
希望对您有所帮助
我正在使用 glide 从服务器图像加载图像,它突然显示没有任何动画。我需要显示带有淡入淡出动画的图像,请给我一些建议。
您必须在 GLIDE 构建器调用中使用 transitions()
API。这里有 2 种可能的方法可以实现这一点。
1) 通过使用转换 API : Official Documentation
GlideApp
.with(context)
.load(....)
.transition(DrawableTransitionOptions.withCrossFade()) //Here a fading animation
.into(....);
2) 通过创建一个 TransitionFactory
:
GlideApp.with(this)
.load(url)
.transition(DrawableTransitionOptions.with(Your_custom_factory))
.into(image)
希望对您有所帮助