I got it working with below code. Problem is, it is not animating all the time. I saw it was not at all animating few times when I launch the application.
@Composable
fun loadGif(){
val imageLoader = ImageLoader.Builder(this)
.componentRegistry {
if (SDK_INT >= 28) {
add(ImageDecoderDecoder())
} else {
add(GifDecoder())
}
}
// customize the ImageLoader as needed
.build()
Providers(AmbientImageLoader provides imageLoader) {
// This will automatically use the value of AmbientImageLoader
CoilImage(
//data = "https://media.giphy.com/media/qVmhGFxmtr2sU/giphy.gif"
data = File("//sdcard/Android/app/anim/my.gif")
)
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…