简体   繁体   English

如何在android中的Recyclerview中停止GIF图像的动画

[英]How to stop the animation of GIF Image in Recyclerview in android

I had to use GIF image in RecyclerView.In first position GIF is playing.我不得不在 RecyclerView 中使用 GIF 图像。首先播放 GIF。 then i moving to the next items.then previous GIF image will should be stop.然后我移动到下一个项目。然后应该停止之前的 GIF 图像。 How to solve this task.如何解决这个任务。

use the getDrawable() method to get the GifDrawable object and call the stop() method:使用getDrawable()方法获取GifDrawable对象并调用stop()方法:

((GifDrawable)buttonGifImage.getDrawable()).stop()

or since you have setup as background resource:或者因为您已设置为后台资源:

buttonGifImage.setBackgroundResource(R.drawable.gifImage);

use: ((GifDrawable)buttonGifImage.getBackground()).stop()使用: ((GifDrawable)buttonGifImage.getBackground()).stop()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM