Skip to content
webtoapkfree

How do I enable pinch to zoom in an Android WebView?

To enable pinch to zoom in an Android WebView, turn on setBuiltInZoomControls and hide the on-screen buttons. The page's viewport tag can still block it.

GuidesNookesh Karri

Light cover card with the title 'How do I enable pinch to zoom in an Android WebView?' in dark text and a green accent bar

To enable pinch to zoom in an Android WebView, call setBuiltInZoomControls(true) on the WebView’s settings, then setDisplayZoomControls(false) to hide the old on-screen buttons. If pinching still does nothing, the page itself is blocking zoom, most often through its viewport meta tag.

The settings that enable pinch to zoom in an Android WebView

Pinch to zoom in an Android WebView is controlled by one setting, setBuiltInZoomControls, and it is off by default. Android’s WebSettings reference says the built-in zoom mechanisms comprise on-screen zoom controls and “the use of a pinch gesture to control zooming.”

webView.settings.apply {
    setSupportZoom(true)
    builtInZoomControls = true
    displayZoomControls = false
}
Setting What it does Default
setSupportZoom Allows zooming with the on-screen controls and gestures true
setBuiltInZoomControls Turns on the built-in zoom mechanisms, including the pinch gesture false
setDisplayZoomControls Shows the on-screen zoom buttons true

The name misleads. “Built-in zoom controls” sounds like the plus and minus buttons, so developers who don’t want buttons leave it off, and the pinch gesture goes with it. The reference calls these mechanisms the only currently supported ones and recommends that the setting is always enabled.

How to hide the zoom buttons and keep the gesture

To keep the pinch gesture without the buttons, enable the built-in mechanisms and set setDisplayZoomControls(false). The buttons show by default once zoom is on, which is why a freshly enabled WebView flashes a small plus and minus overlay.

Android’s docs say on-screen zoom controls are deprecated and recommend setting this to false.

Cross-platform frameworks wrap the same two switches. In .NET MAUI, the EnableZoomControls property controls whether pinch-to-zoom is enabled, and DisplayZoomControls controls whether the buttons are overlaid.

Why pinch to zoom still doesn’t work

When the settings are right and pinching still fails, something outside the settings is blocking the gesture. Four layers can do it, and two of them belong to the site.

Layer What blocks zoom Who can fix it
App settings setBuiltInZoomControls left at false, or setSupportZoom(false) App developer
Viewport meta tag user-scalable=no, or a low maximum-scale Site owner
CSS touch-action: none on the page or a large element Site owner
App layout WebView placed inside a ScrollView App developer

Start with the page. It’s the usual culprit. The viewport tag’s user-scalable value is “a boolean indicating if the user can zoom the web page.” Many mobile templates ship with something like this:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

That tag tells the WebView not to zoom, and your app settings don’t change it. Remove user-scalable=no and the maximum-scale cap, and pinching comes back.

CSS can do the same thing. The touch-action property decides which gestures the browser handles, and none means “disable browser handling of all panning and zooming gestures.” Map libraries and image sliders often set it on a full-width element. The value manipulation keeps panning and pinch zoom and only removes double-tap zoom.

The last layer is the app’s own layout. In one forum thread, a developer had every zoom setting on and still couldn’t pinch. One answer traced it to a ScrollView wrapped around the WebView, which gets in the way of the pinch gesture. A WebView scrolls on its own, so take it out of the ScrollView.

To see which tag and styles the page really sends, inspect the WebView with Chrome DevTools.

Wide viewport and overview mode

Two more settings decide how the page is sized before anyone pinches: setUseWideViewPort and setLoadWithOverviewMode. They don’t enable the gesture, but they explain most “the page loads zoomed in” complaints.

setUseWideViewPort(true) makes the WebView respect the page’s viewport meta tag. If the page has no tag, a wide viewport is used. setLoadWithOverviewMode(true) zooms the content out to fit the screen by width, and it’s off by default.

Turn both on for a desktop-style page with no viewport tag. The page then opens fully zoomed out, and the user pinches in to read. For a responsive site with a proper tag, the wide viewport setting alone is enough.

Zooming without a pinch

You can zoom a WebView from code or change only the text size. Neither needs the gesture.

  • webView.zoomIn() and webView.zoomOut() step the zoom and return true if the zoom changed. The WebView reference also lists zoomBy(), which takes a factor in the range 0.01 to 100.0.
  • setTextZoom sets the text zoom of the page in percent, with a default of 100. Use it for a “larger text” option in your app’s menu.

setSupportZoom(false) does not affect zoomIn() and zoomOut(). That’s useful when you want your own zoom buttons and no gesture.

If you can’t edit the app’s code

If your app came from a no-code builder, you can’t call these methods yourself. The app-side rows in the table are fixed by the builder’s template, and the page-side rows are the ones you control.

This is the limitation of every wrapper. With a WebView-based builder such as Web2Apk, you choose the content and the builder chooses the WebView settings. A site doesn’t always behave in a WebView the way it does in Chrome, so test the installed app and try a pinch on your longest page before you share it.

The page is always yours to fix. Remove user-scalable=no, drop touch-action: none from wide containers, and make the layout readable at its normal size. For a live website, that change reaches the app as soon as you publish it. Bundled HTML needs a new build, as the website to APK guide explains.

Should you leave zoom on?

Yes, leave zoom on unless the screen is a game or a map that handles its own gestures. MDN’s viewport page warns that disabling zoom “prevents people experiencing low vision conditions from being able to read and understand page content.”

WCAG’s resize text criterion expects that text “can be resized without assistive technology up to 200 percent without loss of content or functionality.” MDN adds that the best practice is to allow a 5× zoom.

My take: enable pinch zoom in every content app and stop worrying about users “breaking” the layout. People zoom because they can’t read something. Blocking the gesture leaves the text small and hides the complaint.

Zoom is also one of the places a wrapped site feels different from a native screen. If that matters to you, compare native apps and WebView apps before you commit. If your pages show documents, read how to open a PDF in a WebView, since PDFs are where users pinch most.

FAQ

Is pinch to zoom on by default in an Android WebView?

No. The built-in zoom mechanisms, which include the pinch gesture, are off by default. You enable them with setBuiltInZoomControls(true).

How do I hide the zoom buttons but keep pinch to zoom?

Call setBuiltInZoomControls(true) and setDisplayZoomControls(false). The first turns on the pinch gesture, the second hides the on-screen buttons, which are deprecated.

Why does pinch to zoom still not work after I enable it?

Usually the page blocks it. Check the viewport meta tag for user-scalable=no or a low maximum-scale, look for touch-action: none in the CSS, and make sure the WebView isn’t inside a ScrollView.

Can a website turn off zoom inside a WebView app?

Yes. A viewport tag with user-scalable=no, or CSS with touch-action: none, can stop the pinch gesture even when the app has zoom enabled.

Should I disable zoom in my WebView app?

Usually not. Disabling zoom stops people with low vision from reading the page. Accessibility guidelines expect text to resize up to 200 percent.

Sources