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. SIP API in Android 2.3 with IP/Port problems

Hello everyone,

for a while now I've been playing around with the SipDemo in the 2.3
The documentation on Android's developer page is nicely written, but
not a lot.
It does not explain anything about IPs, ports, NAT and STUN.
I know how this stuff is supposed to work, but it doesn't say how
Android's SIP API handles it. Or does it handle NATs at all...

Here, someone mentioned that the API does do some tests for public IP
and port, but it's the first time I read it:

But now to my problem:
When I deploy the SipDemo as-is either to my device connected to WiFi
or to the emulator, provide my credentials (I know they work with
SipDroid and other SIP apps) the SipDemo displays "registration
I did some sniffing and found out the packets sent to the SipServer
all include the devices or emulators local IP, not my NAT's public
The server replies correctly that RFC1918 IPs are not allowed.

I added a STUN test to the SipDemo and successfully retrieved my
public IP and port. But I can't find a way how to pass it on to my
created SipProfile or the SipManager.

My question:
Has anyone ever made an application working with the SIP API behind a
How does the API handle NATs? How can I pass the information I got
from my own STUN client to the SIP API?

Any help is appreciated.

PS: I know SipDroid and a lot of other SIP implementations, but they
all do not use the built-in API.


2. Unable to mock Android classes

Hi folks,

I'm trying to create a development environment where ALL my Android
code is the subject of unit tests, but I've run into a bit of a hurdle
trying to mock out some Android classes.

Specifically I'm currently stuck on the TelephonyManager (although
there are others).

It has a constructor with the "default" access modifier so trying to
extend or mock it leads to:

java.lang.IllegalAccessError: tried to access method

so, how can we create unit tests around code that use these services
without mocking them out to return specific values? (or just to
eliminate dependencies)




3. Booting 2.6.39 kernel

4. NFC Tags

5. ListView, onFling(horizontal), gesture issues

6. Google Doc Form in Android

7. making keyboard show