Reputation: 1237
Is there any way to prevent android webview to scale the rendered web page .
I need to load an url which has links to other pages .When user clicks these links the rendered page is not aligned properly(i mean it cramps all the stuff within the screen width and height ) as compared to default handling of same web page by android browser .
The alignment is proper when i comment shouldOverrideUrlLoading ,but i need the redirects within my app so i can't avoid overriding shouldOverrideUrlLoading.Is there any other options left out.
The first image shows webview rendering page within my app as i override shouldOverrideUrlLoading and the second image shows the same screen after commenting shouldOverrideUrlLoading.
Upvotes: 1
Views: 6274
Reputation: 12935
Try this:
webview1.getSettings().setBuiltInZoomControls(false);
webview1.getSettings().setSupportZoom(false);
webview1.setInitialScale(100);
Upvotes: 1
Reputation: 51
In the meta tag try doing this
meta name="viewport" content="target-densitydpi=device-dpi"
This should stop the android default scaling
Upvotes: 5
Reputation: 50392
If you need some scaling, this for instance will scale the page to 50% of its original size in the webview :
wv.getSettings().setSupportZoom(true);
wv.getSettings().setUseWideViewPort(true);
wv.setInitialScale(50);
Upvotes: 0