开发者

Fit the content of a WebView on Screen with Zoom suport

I'm trying to embed a HTML5 page into my application.

The content is greater than device, so I'm zooming it with:

web.setInitialScale((int) (728 / 600 * 100)); //728 is the height of the page, 600 of the device

This way the scre开发者_开发问答en is in the correct size, but the content is too small, and I need to have zoom control on it. I tried the supportZoom(true) of the WebView, the zoom IN is correctly, but when zooming out, this doesn't reach my initial scale.


Try this:

        web = (WebView) findViewById(R.id.webview);
        web.getSettings().setBuiltInZoomControls(true);
        web.getSettings().setSupportZoom(true); 
        web.getSettings().setUseWideViewPort(true);
        web.getSettings().setLoadWithOverviewMode(true);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜