在webview android中使用捏

时间:2011-05-13 08:33:35

标签: android webview pinch

我有两个问题:

  • 我发现此代码在webImageView中使用了捏,但是当我webImageView更改WebView时。我在代码中获得了一个错误。我如何在webview中使用捏?

     // create the WebImageView object from xml
    WebImageView img = (WebImageView) findViewById(R.id.main_pic);
    // fetches the image in a background thread
    img.setImageFromURL("http://www.mysite.com/mypicture.jpg");
    // enable pinch-zoom abilities on the image
    new PinchImageView(img);
    
  • 当我在我的代码中添加pinch时,所有移动android都支持,或者你应该有一个特定的屏幕才能使它工作。

2 个答案:

答案 0 :(得分:2)

您可以按照WebView设置

启用WebView缩放
mWebView.getSettings().setBuiltInZoomControls(true);

您也可以使用ZoomDensity

设置默认缩放级别
mWebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);

答案 1 :(得分:1)

您是否添加了日光的参考库? http://code.google.com/p/android-pinch/wiki/PinchImageView