I'm building an app that displays some content in a WebView. I'm styling this content to fit the screen and no zooming is needed. Is there a way do turn off the zooming features of a WebView?
Disable pinch zoom in WebView?
wv.getSettings().setSupportZoom(false);
Is what you want. with setBuiltInZoomControls it won't disable multitouch zooming but this does. Although its worth noting that depending on the device zooming may be disabled by default. I have an app with a WebView in it and on my HTC g2 it doesn't allow me to zoom at all. But the exact same code will allow zooming on Galaxy Tablet.
Interesting. Used both suggestions from this question (even both together) and I can still pinch zoom in the WebView on my nook color. –
Kono
You can try setBuiltInZoomControls(false)
on the WebSettings
. I would expect that would control all forms of zoom, including multitouch.
However, please bear in mind:
there is more than one screen size in Android, and what fits on a QVGA 2.8" screen and what fits on a 10" tablet will not be the same
users might need to zoom for other reasons, such as poor eyesight
Zooming is disabled by default I believe. Both setBuiltInZoomControls and setSupportZoom need to be set to true for zooming to work. –
Severin
Interesting. Used both suggestions from this question (even both together) and I can still pinch zoom in the WebView on my nook color. –
Kono
@thedude19: FWIW, a nook color is not a suitable test platform, except for testing your app for the nook color. The nook color does not have the Android Market on it and therefore does not have to meet any compatibility specifications or pass any compatibility tests. –
Diseuse
@CommonsWare, that is simply not true. The NookColor may not be an suitable test platform since it is a tablet, but it is entirely possible to put Cyanogenmod 7 on it which is (pretty close) to stock android. When almost every single other app from the market works on the CM'd NookColor, I'd say that it SHOULD be a fine testing platform. You may be right, but I don't think so, and specifically not for the reasons that you stated. –
Cologarithm
© 2022 - 2024 — McMap. All rights reserved.