Pinch使用Phonegap和jQUERY Mobile缩放Android [英] Pinch Zoom in Android with Phonegap and jQUERY Mobile

查看:256
本文介绍了Pinch使用Phonegap和jQUERY Mobile缩放Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直很难得到pinch缩放工作在webapp我使用Phonegap创建。目前,我正在加载信息到ap标签视图远程脚本,但html超出了屏幕的限制(当然将横向模式修复这一点)。

I have been having difficult getting pinch zoom to work in the webapp I am creating with Phonegap. Currently, I am loading information into a p tag view a remote script, but the html goes out of the confines of the screen (of course going to landscape mode fixes this).

无关紧要,我尝试我不能得到双指缩放工作,甚至水平滚动条出现。我尝试添加< meta name =viewportcontent =width = device-width,height = device-height,initial-scale = 0.8,user-scalable = 1/>

Not matter, what I try I can't get pinch zoom to work or even a horizantal scrollbar to appear. I tried adding <meta name="viewport" content="width=device-width, height=device-height, initial-scale=0.8, user-scalable=1" /> in the header.

我认为问题可能是我使用jquery mobile,但尝试下面的解决方案没有工作:

I think the problem may be that I am using jquery mobile, but trying the following solution did not work either:

$(document).bind("mobileinit", function(){
      $.mobile.metaViewportContent = "width=device-width, minimum-scale=1, maximum-scale=2";
});

(在jquery mobile js文件包含之前添加)。

(added before jquery mobile js file inclusions).

EDIT :当内容溢出时向右滚动到Ripple仿真器中正常工作。

EDIT: Scrolling to the right when content overflows works fine in Ripple emulator.

UPDATE :好的 - 编辑了我的app.java,我现在可以放大。但是,我只能够放大,而不是缩小,表示初始缩放设置为1我猜。任何人都有关于如何缩小或设置水平滚动条的任何建议?

UPDATE: Okay - edited my app.java and I am able to zoom now. However, I am only able to zoom in, not zoom out, indicating that the initial zoom is set to 1 I guess. Anyone have any suggestions as to how to zoom out or set up a horizontal scroll bar?

package com.phonegap.Sample;

import android.app.Activity;
import android.os.Bundle;
import com.phonegap.*;
import android.webkit.WebSettings;

public class Sample extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{


    super.onCreate(savedInstanceState);
    super.loadUrl("file:///android_asset/www/index.html");

    WebSettings ws = super.appView.getSettings();
    ws.setSupportZoom(true);
    ws.setBuiltInZoomControls(true); 

}
}

资源

推荐答案

jgestures

jgestures

特别适用于Jquery Mobile

especially for Jquery Mobile

这篇关于Pinch使用Phonegap和jQUERY Mobile缩放Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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