gpt4 book ai didi

android - 在 webview android 中使用 pinch

转载 作者:行者123 更新时间:2023-11-29 18:20:05 28 4
gpt4 key购买 nike

我有两个问题:

  • 我发现这段代码在 webImageView 中使用捏合,但是当我通过 WebView 更改 webImageView 时。我在代码中发现错误。我如何在 webview 中使用 pinch?

     // 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 都支持,或者你应该有一个特定的屏幕才能让它工作。

最佳答案

您可以通过以下 WebView 设置启用 WebView 中的缩放

mWebView.getSettings().setBuiltInZoomControls(true);

您还可以使用 ZoomDensity 设置默认缩放级别

mWebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);

关于android - 在 webview android 中使用 pinch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5989287/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com