2

The problem:

I want to use a WebView to enable dynamic loading of ads in my app. I'm currently running on a HDPI device, and images width a width of 480px are clipped/scrolled. If I use images with a size of 320px, they are zoomed in and rendered at too low a resolution.

The content of the loaded WebView url is a simple web page with just an image tag wrapped in a link, as well a simple head. I've tried playing with the viewport meta-tag, but without any luck.

Any suggestions?

Gunnar Lium
  • 6,023
  • 9
  • 35
  • 33

2 Answers2

2

Ok, I seem to have worked it out. It's all explained here: http://developer.android.com/reference/android/webkit/WebView.html, under the heading Building web pages to support different screen densities. Not sure if this section was there when I asked the question, but since my question has had a few views and no solution, I thought I'd post it here.

Gunnar Lium
  • 6,023
  • 9
  • 35
  • 33
  • Hi Gunnar, it would be nice if you would supply the actual answer and not only a link to it. – Janusz Aug 03 '11 at 10:05
  • the section `Building web pages to support different screen densities` was pretty useless to me other than to explain that there's no XXHDPI, XHDPI. Which explains why using MDPI sized graphics actually fit on an XXHDPI device - unfortunately blurred. – Someone Somewhere Feb 27 '14 at 19:43
0

I had the same issue with a subway map image (1000px, also tried 3000 px width before) in a webview: when zooming, the image gets totally blurry, even though the original graphic is very sharp and uncompressed. The only way I found is to split the images into multiple slices and put them back together via html table. This way, the sharpness remains when zooming. Not sure, which device you're on, but there are i.e. some display issues in general with the Nexus One for example: http://www.displaymate.com/Nexus_One_ShootOut.htm

Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192