![](/img/trans.png)
[英]Android: how to stop animation for a gif image button when pressed in Java?
[英]How to stop the animation of GIF Image in Recyclerview in android
我不得不在 RecyclerView 中使用 GIF 图像。首先播放 GIF。 然后我移动到下一个项目。然后应该停止之前的 GIF 图像。 如何解决这个任务。
使用getDrawable()
方法获取GifDrawable
对象并调用stop()
方法:
((GifDrawable)buttonGifImage.getDrawable()).stop()
或者因为您已设置为后台资源:
buttonGifImage.setBackgroundResource(R.drawable.gifImage);
使用: ((GifDrawable)buttonGifImage.getBackground()).stop()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.