1

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.

android webview

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.

1
  • Are you sure this is an issue of scaling and not CSS? Commented Aug 19, 2010 at 12:50

3 Answers 3

5

In the meta tag try doing this

meta name="viewport" content="target-densitydpi=device-dpi"

This should stop the android default scaling

Sign up to request clarification or add additional context in comments.

1 Comment

The meta tag target-densitydpi has been removed from the WebKit specification. You will face problems on JellyBean devices. See this question or this blog post.
1

Try this:

webview1.getSettings().setBuiltInZoomControls(false);
webview1.getSettings().setSupportZoom(false);
webview1.setInitialScale(100);

Comments

0

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);

1 Comment

thanks sephy ,but setInitialScale has no effect .i am still wondering about the reason.I see no problem with css hence it loads perfectly in Android browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.