WebView Rending 100% wide HTML

by Brian » Sat, 27 Mar 2010 03:55:39 GMT

Sponsored Links
 I am working on an app that has a WebView that contains 5 pages. When
the webview page is first loaded, everything displays fine, but as
soon as you click Next on the first page everything shrinks down, as
if the webview window size has collapsed. Then when you click back to
the first page, it is collapsed as well, even though it displayed fine
when the window first opened.

I am thinking somehow the webview is changing size because the color
is just white surrounding my smashed page, even though the background
color of the page is dark.

This only happens when the content is set to be 100% wide in the HTML,
if I set a pixel width it maintains the size, but I need it to scale
for the different android phones.

Any thoughts / ideas?


WebView Rending 100% wide HTML

by Joe Bowser » Wed, 31 Mar 2010 02:37:03 GMT

 Have you tried setting the Initial Scale to 100%, and setting the
Layout Algorithm to normal?  A code example is below (assume appView
is a WebView):

        WebSettings settings = appView.getSettings();

Also, if you use the viewport tag in your header, it will scale it to
the resolution:
<meta name="viewport" content="width=320; user-scalable=no" />

I prefer NOT using the viewport meta tag, and actually using HTML and
CSS relative values for HTML-based UI whenever possible.  Setting the
Layout Algorithm is essential if you want your CSS to actually work
properly so that 100px is really 100px.


Sponsored Links

Other Threads

1. Moving gif android

Lutju...mau lagi dunk... hehe

HD2 - JawsMIUI


2. bitmap image from a SurfaceView


I would like to create a bitmap image from some freehand drawing on a
surface view...if someone shows me the way, that will be of immense
help... i tried setDrawingCacheEnabled(true) and getDrawingCache(true)
of the view class...but its not working...

are these two functions behave differently for surfaceview?

thanks in advance....



3. Free gesture library

4. Live Wallpaper Memory Allocation

5. Couldn't refresh list

6. call .net web service from android

7. Difference between zImage (bootp) and boot.img