How a change the content size of a webview in android?

后端 未结 2 650
离开以前
离开以前 2021-01-18 05:13

I have a webview control in a scrollview. when i load a long html document into it, it resizes to accommodate it. this is correct. however, when i use the same control again

2条回答
  •  孤独总比滥情好
    2021-01-18 05:51

    This didn't work for me when using:

    loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl)
    

    But calling requestLayout() on the webview after loading the data worked except for a strange glitch with the scrollbar flickering if changing the view while scrolling.

    webView.clearView();
    webView.loadDataWithBaseURL(null, data, "text/html", "utf-8", null);
    webView.requestLayout();
    

提交回复
热议问题