Webview height not changing after resize font size

前端 未结 4 1866
猫巷女王i
猫巷女王i 2021-01-20 04:16

In my application I use a ScrollView. This ScrollView contain many Webview. I change the webview font size:

webView.getSettings().setTextSize(WebSettings.Tex         


        
相关标签:
4条回答
  • 2021-01-20 04:23
    private void reloadWebView() {
        // TODO Auto-generated method stub
        postDelayed(new Runnable() {
            @Override
            public void run() {
                clearView();
                reload();               
                myWebView.getSettings().setJavaScriptEnabled(true);
                requestLayout();
            }
        }, 10);
    }
    
    0 讨论(0)
  • 2021-01-20 04:36

    You can use this:

    myWebView.loadUrl("about:blank");
    
    0 讨论(0)
  • 2021-01-20 04:41

    I had the same problem and fixed it using code:

    private void reloadWebView() {
        postDelayed(new Runnable() {
            @Override
            public void run() {
                clearView();
                requestLayout();
            }
        }, 10);
    }
    

    Call it method when You have finished zooming. It will refresh web view and recalculate it size.

    0 讨论(0)
  • 2021-01-20 04:43

    you might have to reload your webview with ie:

    webview.loadUrl( "javascript:window.location.reload( true )" );
    
    0 讨论(0)
提交回复
热议问题