Can Android's WebView automatically resize huge images?

前端 未结 8 1848
心在旅途
心在旅途 2020-11-28 05:41

In some web browsers, huge images are automatically resized to fit the screen.

Is it possible to do the same in an Android WebView?

The web page just contain

8条回答
  •  独厮守ぢ
    2020-11-28 06:16

    If your WebView width is fill_parent then you can use this code:

    Display display=getWindowManager().getDefaultDisplay();
    int width=display.getWidth();
    String data="";
    webView.loadData(data, "text/html", "utf-8");
    

    And zoom still working!

    Same method if height is fill_parent.

提交回复
热议问题