科尔多瓦:如何启用视口放大 [英] Cordova : How to enable viewport zoom

查看:178
本文介绍了科尔多瓦:如何启用视口放大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我试图启用本地视变焦(如本地网络变焦我的意思)在科尔多瓦的Andr​​oid(web视图)。

I'm currently trying to enable native viewport zoom (like the native web zoom I mean) on Cordova Android (webview).

下面是我的视口代码:

 <meta name="viewport" content="user-scalable=yes, initial-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

和我想是这样的:

         function onDeviceReady() {


                ImgCache.options.chromeQuota = 50*1024*1024;

                var domElement = document.getElementById('main-html');
                angular.bootstrap(domElement, "myApp");

                webView.getSettings().setBuiltInZoomControls(true); // this line

            }

由于有说:<一href=\"http://stackoverflow.com/questions/7121053/how-to-enable-zoom-controls-and-pinch-zoom-in-a-webview\">How启用缩放控制,并在网页视图捏变焦?

但它不工作。我所缺少的?

But it doesn't work. What I am missing ?

推荐答案

试试这个。

把按照您的index.html

put following in your index.html

<meta name="viewport" content="user-scalable=yes, initial-scale=1, maximum-scale=2, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

把你的主要的Andr​​oid Java文件的onCreate方法下面的src / COM /包名目录中:

put following in the onCreate method of your main Android Java File inside src/com/packagename directory:

super.appView.getSettings().setBuiltInZoomControls(true);
super.appView.getSettings().setDefaultZoom(ZoomDensity.MEDIUM); 
super.appView.getSettings().setSupportZoom(true);

也是你的主要的java文件中添加下列包:

also add following packages in your main java file:

import android.webkit.WebSettings; 
import android.webkit.WebSettings.ZoomDensity;

希望这有助于...

Hope this helps...

这篇关于科尔多瓦:如何启用视口放大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆