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. Getting change details from content provider notifications

Using ContentResolver and ContentObserver, it is possible to receive
notifications in the function onChange() when some data is changed
within the content provider. However, I fail to see if there is a way
to see the URI which triggered the notification.

For instance, if I want to play a sound when someone deletes "Kara
Trace" from my address book or whatever - how do I do that, if not by
having another copy of the whole content provider dataset, and then
comparing the old dataset copy with a new one?
Can someone confirm me that the hard way is the only way?


Thanks.

P.

--~--~---------~--~----~------------~-------~--~----~

2. How do you change a Spinner's typeface?

I want to apply a non-native font to widgets in my app. This is
working fine for TextViews and Buttons, which have a setTypeface
method. The code below works just great for my button:

Java:
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/
my_font.ttf");
playButton = (Button) findViewById(R.id.play_button);
playButton.setTypeface(face);


But I just can't seem to figure out how to apply the font to a
Spinner. Any ideas?

--~--~---------~--~----~------------~-------~--~----~

3. Android 1.1 virtual devices don't show up as run targets

4. Changing the application icon at runtime?

5. Please find the requestion with me

6. How to launch internal activity from PreferenceScreen

7. Overview Of New Intel Core i7(Nehalem) Processor