您当前的位置: 首页 >  ide

蓝不蓝编程

暂无认证

  • 0浏览

    0关注

    706博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

通过Glide播放/停止gif

蓝不蓝编程 发布时间:2019-12-12 10:29:53 ,浏览量:0

添加依赖
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
播放gif
Glide.with(this).asGif().load(R.drawable.test).into(imageView)
停止gif
button.setOnClickListener {
    if (imageView.drawable is GifDrawable) {
        val drawable = imageView.drawable as GifDrawable
        if (drawable.isRunning) {
            drawable.stop()
        } else {
            drawable.start()
        }
    }
}
源代码

https://gitee.com/hspbc/stop_gif

关注
打赏
1639405877
查看更多评论
立即登录/注册

微信扫码登录

0.0759s