msumaithri msumaithri - 1 month ago 16
Android Question

GIF Image display using WebView

Can someone please provide a code to display GIF images in a webview ( I'm already able to display the same using frame animation of png images) Now I want a way to display the GIF images rather than loading the frames or drawing the images again and again!

Answer

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");
Comments