【问题标题】:How do load images in Glide with Animation [closed]如何在 Glide with Animation 中加载图像 [关闭]
【发布时间】:2020-01-07 05:24:59
【问题描述】:

我正在使用 glide 从服务器图像加载图像,它突然显示而没有任何动画。我需要显示带有渐变动画的图像,请给我一些建议。

【问题讨论】:

    标签: android android-recyclerview android-animation android-glide


    【解决方案1】:

    您必须在 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)
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-23
      • 2016-05-09
      • 1970-01-01
      • 2018-09-08
      • 2012-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多