我正在尝试将HTML5页面嵌入到我的应用程序中.
内容大于设备,所以我用它来缩放:
web.setInitialScale((int) (728 / 600 * 100)); //728 is the height of the page, 600 of the device
Run Code Online (Sandbox Code Playgroud)
这样屏幕尺寸正确,但内容太小,我需要对其进行缩放控制.我尝试了WebView的supportZoom(true),缩放IN是正确的,但是当缩小时,这不会达到我的初始比例.
小智 25
试试这个:
web = (WebView) findViewById(R.id.webview);
web.getSettings().setBuiltInZoomControls(true);
web.getSettings().setSupportZoom(true);
web.getSettings().setUseWideViewPort(true);
web.getSettings().setLoadWithOverviewMode(true);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12255 次 |
| 最近记录: |