tae jun Kim
tae jun Kim

Reputation: 176

android webview zoom in/out bug

I had set zoom control on webview

webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setSupportZoom(true);

But it work not correctly.

If i touch screen for zoom out (multi touch use finger) it working in a state of touching screen.

But if i detach screen, it comeback initial size.

and zoom control remember zoom out operation working correctly.so i do again again again

And zoom control '+' button change disable state ( MAX zoom out state )

But webpage is still not change . (zoom was not work)

I think this is bug..

The webpage is html made by programally

like this

<meta http-equiv=’Content-Type’ content=’text/html; charset=utf-8′ />
<html>
<body>
<img src="my image url" width="100%"></img></br>
</body>
</html>

It's so simple html source.

Any idea for this??

Can i fix it?

Upvotes: 0

Views: 1424

Answers (2)

olik79
olik79

Reputation: 1412

I had a very similar problem, and think you have to replace the relative width with an absolute one. The source of the problem is, that the webview recalculates the width after you zoomed and again scales the image to fit 100% of screen width. I resized the image to the size of the screen in pixels (directly generated into the html code). Then the zoom works without problems.

See: Set minimum zoom level of webview (Android)

Upvotes: 2

Abhirup Ghosh
Abhirup Ghosh

Reputation: 153

Just delete the width="100%" from your image tag. It will start working magically.

Upvotes: 0

Related Questions