0

So, this is the HTML I want to load in my WebView and it doesn't resize. I'm using the same Activity to load these HTMLs (same width): this and this

I have used many things to resize and I get no resized with none:

Tried as well on WebClient.onPageFinished

I'm getting my page refreshed (or the View) as well every 1 - 3 seconds automatically, getting a lot of messages from Logcat like:

onSizeChanged - w:480 h:0

onSizeChanged - w:480 h:491

onSizeChanged - w:480 h:1887

and many more...

The weird thing is that other pages work corretly.

My code is this:

        webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.setBackgroundColor(Color.TRANSPARENT);
    webView.loadUrl(URL);

    WebViewClient client = new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            pb.setVisibility(ProgressBar.GONE);
        } 
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url != null && url.startsWith("http://")) {
                view.getContext().startActivity(
                    new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                return true;
            } else {
                return false;
            }
        }
    };
    webView.setWebViewClient(client);

Thanks in advance.

Community
  • 1
  • 1
Rafael Ruiz Muñoz
  • 5,333
  • 6
  • 46
  • 92

1 Answers1

1

Solved:

if this happens, means that the HTML has tags like <meta name="viewport" content="width=640, user-scalable=no">

and user-scalable=no doesn't allow to scale the HTML.

Rafael Ruiz Muñoz
  • 5,333
  • 6
  • 46
  • 92