开发者

Android - WebView zoom image to full width?

When viewing an image in a WebView, is there a programmatic way to force the WebView to automatically zoom the im开发者_如何学运维age until it's full width in the view?


This html code shows an image at full size:

<html><head></head><body><img src= "imagename.jpg" width="100%" height="100%"></body></html>

Now create a javascript function(showImage) that prints this.(I don't know how to do that).

And call your javascript function like this:

myWebview.loadUrl("javascript:showImage("imagename.jpg")");

How you can call a Javascript function from android code is explained here:
http://android-developers.blogspot.com/2008/09/using-webviews.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜