How to set the initial zoom/width for a webview

后端 未结 8 1476
無奈伤痛
無奈伤痛 2020-11-27 11:08

I am trying to get the WebView to have similar behavior as the android browser. The browser opens all pages in a way that tries to fit their width to the screen. However,

8条回答
  •  孤独总比滥情好
    2020-11-27 11:50

    It is and old question but let me add a detail just in case more people like me arrive here.

    The excellent answer posted by Brian is not working for me in Jelly Bean. I have to add also:

    browser.setInitialScale(30);
    

    The parameter can be any percentage tha accomplishes that the resized content is smaller than the webview width. Then setUseWideViewPort(true) extends the content width to the maximum of the webview width.

提交回复
热议问题