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”
/>
【android 加载 .gif 并一直刷新】3.如果不gif文件播放了一次就不播放了

private void gifLoop(){ GifImageViewgifImageView = (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); }

    推荐阅读