GIF Image display using WebView

Try this..

WebView wv = (WebView) findViewById(R.id.webView1);
wv.loadUrl("file:///android_asset/anim5.gif");

Simply call your GIF image from assets like this..


Loads gif in a webview and fits it to the device screen without any HTML code...Try this code

mWebView = ((CustomWebView)mRootView.findViewById(R.id.webview));
mWebView.loadUrl("file:///android_asset/file.gif");
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);

Gifs are supported in web view.

write a html file as following :

<html>
<body bgcolor="white">
    <table width="100%" height="100%">
        <tr>
            <td align="center" valign="center">
                <font color="gray">Some text you display</font>
                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <img src="yourGIF.gif">
            </td>
        </tr>
    </table>
</body>

and store it in "assets" folder of you application also store your gif in the same folder. And do following to show it:

webview.loadUrl("file:///android_asset/your_html.html");

This is the best solution for GIF in Android :

Insert the following dependency to build.gradle file of your project.

dependencies {
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
}

then

The simplest way is to use GifImageView 

<pl.droidsonroids.gif.GifImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/src_anim"
    android:background="@drawable/bg_anim"
    />

If drawables declared by android:src and/or android:background are GIF files then they will be automatically recognized as GifDrawables and animated. If given drawable is not a GIF then mentioned Views work like plain ImageView and ImageButton.

https://github.com/koral--/android-gif-drawable