How to show Animated GIF image in android application?

后端 未结 11 1610
臣服心动
臣服心动 2020-12-28 13:16

I want to show an animated GIF image in an android application like the image below. I have tried the webview but no success. How to show the animated gif in the application

11条回答
  •  北海茫月
    2020-12-28 14:11

    You may have a try on this lib GifImageView. It's very simple and easy to use. The following sample code is from README of this project.

    @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState);

    gifView = new GifImageView(context);
    gifView.setBytes(bitmapData);
    setContentView(gifView);
    

    }

    @Override protected void onStart() { super.onStart(); gifView.startAnimation(); }

    @Override protected void onStop() { super.onStop(); gifView.stopAnimation(); }

提交回复
热议问题