Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 976
msumaithri Avatar asked Jan 28 '11 06:01

msumaithri


People also ask

How do you display a gif in HTML?

Animated images in HTML are an image on a web page that moves. It is in GIF format i.e. Graphics Interchange Format file. To add an animated image in HTML is quite easy. You need to use the <image> tag with the src attribute.

Can we show gif in Imageview in Android?

Graphics Interchange Format(GIF) pictures play a huge part in little picture movement. Actually Android doesn't provide any support for GIF animation in the image view, but displaying a GIF image in an android application is not an exhausting process.


2 Answers

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);
like image 191
tony baby Avatar answered Oct 06 '22 00:10

tony baby


You do not need any HTML code... Just use this line

webViewControl.LoadUrl("file://" + pathToTheGifFile);

It Works for Me.

like image 23
1lb3r Avatar answered Oct 06 '22 00:10

1lb3r