WebView in Android 4.4 and initial-scale

前端 未结 2 1499
孤街浪徒
孤街浪徒 2021-01-14 08:53

I\'ve been banging my head against the wall for the whole day now, and i need some help :(

The problem is, that i have a WebApp that was designed for 640x960

2条回答
  •  情歌与酒
    2021-01-14 09:22

    Just had a run through of this after not quite being sure of the answer myself.

    http://www.gauntface.co.uk/blog/2013/11/29/desktop-site-and-the-viewport/

    You want a viewport without an initial-scale if you only want the webpage to fit the WebView's width.

    Things that will affect the WebView:

    1. Ensure you have setUseWideViewport() enabled so the page can be larger than the devices width: http://developer.android.com/reference/android/webkit/WebSettings.html#setUseWideViewPort(boolean)
    2. Ensure you targetSDKVersion=19 to ensure you aren't getting any compatibilities for the old webview

    If you want to prevent the user from zooming in or out, use user-scalable=no in the viewport rather than set a min and max.

提交回复
热议问题