Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-visible zoom controls in WebView

I want pinch-to-zoom in WebView but I dont want it to have the integrated control (the little zoom in and zoom out buttons) all I want is the pinch to zoom.
I tried this and it didn't work:

wv1.getSettings().setBuiltInZoomControls(false);
wv1.getSettings().setSupportZoom(true);

Any ideas would be great!

p.s. I'm using API Version 8

like image 360
William Lewis Avatar asked Nov 09 '11 04:11

William Lewis


People also ask

Which method is used to show zoom controls which we hide from the screen?

2. show(): This method is used to show the ZoomControls which we hide from the screen by using hide method.

What are two methods used for zoom control?

Important Methods of Zoom Controls ZoomControl zoomControls = (ZoomControls) findViewById(R. id. simpleZoomControl); show(): This method is used to show the zoom controls on the App UI.

What is zoom control in Android?

In android, Zoom In and Zoom Out animations are used to change the appearance and behavior of the objects over a particular interval of time. The Zoom In and Zoom Out animations will provide a better look and feel for our applications.


1 Answers

On API 11 or greater, you can use:

webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setDisplayZoomControls(false);

From API 11,

public void setDisplayZoomControls (boolean enabled)

Sets whether the on screen zoom buttons are used. A combination of built in zoom controls enabled and on screen zoom controls disabled allows for pinch to zoom to work without the on screen controls

Look at enable/disable zoom in Android WebView.

like image 174
user370305 Avatar answered Oct 03 '22 02:10

user370305