How to remove the WebView top/left 8-pixel inner margin?

by Mattaku Betsujin » Mon, 13 Apr 2009 20:23:22 GMT

Sponsored Links
 I think the margin is probably implemented in C code inside WebKit. I looked
at this in the past as well and couldn't find any Java options to configure
the margins.

What do you mean by accuracy? Do you mean finding the exact position of your
HTML objects inside the WebView?


How to remove the WebView top/left 8-pixel inner margin?

by Mattaku Betsujin » Tue, 14 Apr 2009 05:27:53 GMT

 There is a hack to do what you want -- make your WebView into a width of 336
-- that way you will have extra 8 pixels on each side. Then, put in
somewhere off screen (use absolute layout), and get a drawing cache from it.
That way, you can use the drawing cache bitmap, and draw that onto the real
screen (minus the 8 pixel borders).

You should also override the onDraw() method. This way you know whenever the
webview changes, and reload your drawing cache.

If you want to handle user input, that would require more hacks so that you
can feed the events to the webview.

I have not exactly done this before, but I have been using WebView in
hackish ways and I think this might work.

Good luck!


Sponsored Links

How to remove the WebView top/left 8-pixel inner margin?

by Mattaku Betsujin » Tue, 14 Apr 2009 05:49:18 GMT

 Oh, come to think of it, (assuming you want a WebView banner at the top of
the screen) if you use AbsoluteLayout, you can put the WebView at (-8,-8).
This can get rid of the top,left, and right edge.

Then, place another View over the bottom edge of the WebView to cover that
part as well. this way, you have the visible areas of the WebView to extend
exactly to where you want it.

On Mon, Apr 13, 2009 at 2:25 PM, Mattaku Betsujin <


Other Threads

1. How to deal with ExpandableList when all the data are coming from datebase?

I want to the effective like ExpandableList1 Activity in apidemo.But
my data is from the database.And th groups's data from the database
and the children's data from the database too.All both are comg from
different tables.
First,i want to konw how to get data from the cursor to String[];
Second,i want to konw how to confirm the data of children[][].

Thank you.

2. VPN on android ?

Hello all,

can anyone explain in simple words why android fails to support simple vpns
like pptp that are common among every single linux distro on this planet? 
If android really were an open platform I would be able to patch it in myself,
but additionally there is no doc available how to do that on a G1. I really
wonder what makes people believe in android instead of iphone. Both are quite
closed platforms, but on iphone vpns are no problem...
Hello google, have you really thought about it all ? If you want gamers as
customers build a game console. If you want to sell phones you should have
thought about the nature of phone numbers and why they may contain "*" and "#"
and what implications that has on sending text messages.
If you sell a phone with keyboard (G1) you should have thought about customers
in corporate entities (the ones that really need a keyboard) that have to use
vpns for security reasons. If there were no need for working we all would be
pleased {*filter*} pacman on android. But since we have to work we probably should
use another phone (platform).



3. Where do you find good Android Software Developers?

4. Is there a way for us to show ProgressBarIndeterminate in Theme.Dialog activity?

5. Radio's Colorthon Tutorial Now Available on YouTube

6. Where do you find good Android Software Developers?

7. How to change default page in android browser