如何在此库中显示动画 GIF?

How can I show animated GIFs in this library?

如何显示动画 GIF with this library? 下面的代码只显示了 GIF 的静态版本,而不是动态版本。

    addSlide(new SimpleSlide.Builder()
            .title("This is supposed to be an animated GIF")
            .image(R.drawable.animated_gif)
            .build());

我看过 Glide 但我不确定在这种情况下如何使用它。

不可以 Material intro.Consider 使用另一个库,如 pl.droidsonroids.gif:android-gif-drawable 在你的 Gradle 上有 implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'

然后在你的 xml

<pl.droidsonroids.gif.GifImageView
    android:id="@+id/gif_view"
    android:layout_width="40dp"
    android:layout_height="44dp"
    android:scaleType="fitXY"
    android:src="@drawable/yourgif">

为什么不直接用 ImageView 插入 GIFS?您可以按照说明 here.

您可以使用 glide 来加载您的 gif,因此在您的 gradle 中将其包含在您的依赖项中

  implementation 'com.github.bumptech.glide:glide:4.3.1'

然后在您的activity中像下面那样使用它

Glide.with(this\*your context*\).load(R.drawable.animated_gif).into((ImageView)findViewById(R.id.ImageViewId));

使用Glide

Glide.with(this)
.asGif()
.load("gifSourse")
.into(targetImageView);