频道栏目
首页 > 资讯 > Android > 正文

android 加载 .gif 并一直刷新实现方法

17-11-14        来源:[db:作者]  
收藏   我要投稿

android 加载 .gif 并一直刷新实现方法。

1.
dependencies {
compile ‘pl.droidsonroids.gif:android-gif-drawable:1.2.+’
}

2.
< pl.droidsonroids.gif.GifImageView
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:background=”@drawable/gif_file”
/>

3.如果不gif文件播放了一次就不播放了

private void gifLoop(){
        GifImageView  gifImageView = (GifImageView) findViewById(R.id.gif_bg);
        GifDrawable gifDrawable = null;
        try {
            gifDrawable = new GifDrawable(getResources(), R.drawable.login_bg);
            gifDrawable.setLoopCount(0);
        } catch (IOException e) {
            e.printStackTrace();
        }
        gifImageView.setImageDrawable(gifDrawable);
    }
相关TAG标签
上一篇:AndroidStudio托管新项目至码云实现方法
下一篇:配置静态路由进阶实验教程
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站