How to play gif with Fresco

原文地址:https://stackoverflow.com/a/34892610

Put your gif in res/raw folder.
In this example res/raw/splash.gif

1
2
3
4
5
6
7
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithResourceId(R.raw.splash).build();
SimpleDraweeView draweeView = new SimpleDraweeView(this);
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(imageRequest.getSourceUri())
.setAutoPlayAnimations(true)
.build();
draweeView.setController(controller);

坚持原创及高品质技术分享,您的支持将鼓励我继续创作!