g123k g123k - 4 months ago 27
HTML Question

Android webview : dezoom to fit content

I have an html content with a mandatory fixed size (let's say 500px).
If the screen is large enough, I center the content.

However, if the width is less than 500px, I have to unzoom to have all the content. I guess I have to change the viewport in the html, but all my tries have failed.

Note: In every case, the user can zoom.

Do you have an idea how to achieve this?
Thanks.

Answer

The solution I have used is simply to call this method :

webView.setInitialScale(xxx)

When the scale is 100, it means no zoom.