android - Restrict zoom in webview app -


i have simple android webview app little except load url , display , links within app.

via css, i've set webpage 720px x 1280px (theoretically) fill screen of galaxy s3 completely.

within webview's java code, i've tried make page cannot zoomed in or out, , displays fullscreen, following code:

requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); mwebview.getsettings().setsupportzoom(false); mwebview.getsettings().setloadwithoverviewmode(true); mwebview.getsettings().setusewideviewport(true); 

i've verified webpage right size (720 x 1280) using css ruler built, can see, webview app doesn't display @ scale when loads:

enter image description here

i can double-tap on screen , zoom in, though thought disabled zoom in java code. then, doesn't zoom 100%...it zooms more that:

enter image description here

so basically, how manipulate webview show page @ desired size, without allowing user change scale?

you need use meta viewport tag in html scale content device size. can disable zoom using tag.

add in head of html document:

<meta name="viewport" content="width=device-width, user-scalable=no"> 

further reading: mdn - viewport meta tag


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -