Barry
Barry

Reputation: 91

Android WebView Zoom out limited

I am using a WebView in Android. After loading a webpage I would like to use the on-screen Zoom out control. After one or two clicks it becomes grayed and no longer allows me to zoom out any further. When I call the zoomOut() function in code, it also does not zoom out any further.

What is limiting how much I can zoom out. I would expect to be able to zoom out much further than I am allowed - to the point of making the page too small to read. But, zoom out is disabled well before I reach this level of zoom.

Any help is greatly appreciated.

Thanks, Barry.

Upvotes: 9

Views: 7376

Answers (3)

Ravi
Ravi

Reputation: 2367

Hey Barry The built in range for that zoomin and zoomout function is starts from 0.8 something that is the minimum value after this if you will call the zoomout function it will return the false value and maximum value for zoomin is upto 4.0 ,So these zoomin and zoomout functions are of boolean type Like for a zoomin function wverytime you call zoomin function it multiply with some factor and return true if further zoomin is possible and whenever it reaches to the last point that is 4.0 so it will return false and after that it will not zoom in.

Upvotes: 0

wnafee
wnafee

Reputation: 2146

You should probably do this myWebView.getSettings().setUseWideViewPort(true)

You'll then see that you can zoom out farther than what you usually see on default settings.

Upvotes: 20

Squonk
Squonk

Reputation: 48871

Take a look at WebView.setInitialScale(...) - I'm not sure if it will help you with what you want but setting it to 50, for example, will scale the WebView to 50% of its normal size. I think that will allow you to zoom in and then out again to the (initial) smaller size.

Upvotes: 2

Related Questions