【问题标题】:Fitting webview on screen without access to webpage code在不访问网页代码的情况下在屏幕上安装 webview
【发布时间】:2016-05-11 21:52:59
【问题描述】:

好的,我有一个 webview,我正在尝试加载这个 url:http://catalog.ccbcmd.edu/preview_course_incoming.php?catname=Catalog%202015-16&prefix=ENGL&code=101

我无权访问任何页面的源代码来编辑它。我想格式化 webview,这样视图就不必水平滚动,但是,当我把它全部放在屏幕上时,它太小了。有人可以帮忙吗?如果需要,我可以使用垂直滚动条。

更新:这是我的代码

    WebView webView = (WebView)findViewById(R.id.webView);
    webView.setWebViewClient(new WebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.setScrollContainer(false);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setDisplayZoomControls(false);
    webView.setScrollbarFadingEnabled(false);      
    webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/4.0");
    webView.loadUrl(url);

【问题讨论】:

    标签: android html webview android-webview


    【解决方案1】:

    你能启用缩放吗?

    webView.getSettings().setBuiltInZoomControls(true);

    这样。

    【讨论】:

      【解决方案2】:

      尝试使用文本自动调整大小,它会自动放大您的文本。它适用于 KITKAT 及更高版本。

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
          browser.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
      }
      

      【讨论】:

        猜你喜欢
        • 2011-08-12
        • 1970-01-01
        • 1970-01-01
        • 2017-01-31
        • 2011-01-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多