如何在android中图像检查动画?

问题描述 投票:0回答:1

我想检查从 Android Gallery 收到的照片是动画还是只是照片。

我通过搜索找到了AnimationDrawable,发现它检查了,但是总是返回N。

前图像 https://bigfile.mail.naver.com/download?fid=8/RrbrCXWHM/FoujK3YZKxuXFxtjKogZFAg9KA2wKAumKAEjKxbwFqbXKoKla3YXpzMXFo+CFx30p6FSKA+0aAFSKAvXM4UlFxISKzKmFg==

val uri = Uri.parse(getPath(element.path ?: "", requireContext()))
val path = uri.path
val drawable: Drawable? = Drawable.createFromPath(path)

 if (drawable is AnimationDrawable) {
    imageGif.add(ImageData(0L, element.path!!))
    Timber.d("Test Checked Animated: Y")
 } else { 
     imageUris.add(element)
     Timber.d("Test Checked Animated: N")
}
android image kotlin android-drawable
1个回答
0
投票

我找到小姐了

没有可绘制动画

我需要使用这个AnimatedImageDrawable

© www.soinside.com 2019 - 2024. All rights reserved.