我正在尝试在 XML 布局中添加 GIF
一开始它工作正常,但是当我关闭 android studio 并再次打开它时 它给我错误!
另外,我尝试降低 GIF
的质量和空间,一开始效果很好,但重启后出错!
这是我的 XML 代码:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical">
<pl.droidsonroids.gif.GifImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/myimg"/>
</LinearLayout>
错误
最佳答案
您可以将 Glide 用于常规 ImageView
Glide.with(this).load(R.drawable.myimg).into(imageView)
在build.gradle(module:app)中添加如下依赖
implementation 'com.github.bumptech.glide:glide:4.9.0'
导入:
import com.bumptech.glide.Glide
引用:https://www.tutorialspoint.com/how-to-display-animated-gif-images-in-android-using-kotlin
关于android - 在 android 布局中添加 GIF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42898968/