i am trying to load some web pages in web view of my android app. By default when the page gets loaded i want the web page to be within the device screen size, without any scroll bars making to move either horizontally or vertically.Is this possible. I found a option of adding view port in the webpage as follows,

<meta name='viewport' content="width=devicewidth"/>

Here what is mean by device width, if it refers to the android device width which i am using, then how it will be applicable from all the android devices.

what can i do if the web page is out of my control. Is there any way to add the view port in my apps code. How to do this.......

有帮助吗?

解决方案

Try using combination of

yourWebView.getSettings().setLoadWithOverviewMode(true); yourWebView.getSettings().setUseWideViewPort(true);

The page will be loaded completely zoomed out and no scrollbars will be getting in the way (I think).

You can also add

yourWebView.getSettings().setSupportZoom(false);

to disable zooming.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top