Playing an animated GIF image file in imageview

后端 未结 3 2152
既然无缘
既然无缘 2021-02-15 15:51

I am making an Android application, in which I want to play a GIF file in an imageview. I have a tried a lot of ways, made a custom class but haven\'t succeeded.

Has an

3条回答
  •  伪装坚强ぢ
    2021-02-15 16:53

    You can display Gif in android without using any 3rd party libraries. This is how I did that.

    Take a web view.

    
    

    Most of the examples shows how to open a file from asset folder, but here I show you how to open it from a SD Card/memory.

        WebView webView = (WebView) findViewById(R.id.imageWebView);
        String  data    = " ";
        // 'filePath' is the path of your .GIF file on SD card.
       webView.loadDataWithBaseURL("file:///android_asset/",data,"text/html","UTF-8",null);
    

提交回复
热议问题