如何在imageview中显示.gif文件? [英] How to display .gif file in imageview?

查看:59
本文介绍了如何在imageview中显示.gif文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的布局有很多图像视图.我想在一个图像视图中显示 .gif 动画文件.我尝试了 Yash 方法(在 android 的 ImageView 中添加 gif 图像) 但 .gif 文件显示了所有布局.其他视图消失了.

My layout have lots of imageviews. I want to show .gif animated file in just one imageview. I tried Yash method (Adding gif image in an ImageView in android) but .gif file shown all layout. Other views dissappeared.

我想全部展示.

有什么想法吗?

推荐答案

如果您不想使用 Glide, 只需将其添加到您的依赖项中并创建您独特的gif".使用前检查最新版本.图像视图:

If you don't want to use Glide, just add this to your dependencies and create your unique 'gif'. Check for the latest version before use. ImageView:

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'

以最少的代码行非常有效地工作.一个例子是:

Works very efficiently with minimal lines of code. An example is:

<pl.droidsonroids.gif.GifImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/dancer"
        android:src="@drawable/maddancer" />

这篇关于如何在imageview中显示.gif文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆