Setting the margin/padding to zero seems to take care of it here:
String html = "<html><head><style>* {margin:0;padding:0;}</style></
head><body><div style='border:1px #000 solid;width:240px;height:
200px;'/>Test</div></body></html>";

On Feb 24, 4:14 am, Carl Whalley <[email protected]> wrote:
> There seems to be a default inner border in the WebView - it's about 6
> pixels all round. How can this be removed so the size matches the
> content?
>
> Simple demo (target is Google API 1.6):
>
> public class Main extends Activity {
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>         WebView webview = (WebView) findViewById(R.id.webview);
>
>         String html = "<html><body><div style='border:1px #000
> solid;width:240px;height:200px;'/>Test</div></body></html>";
>         webview.loadData(html, "text/html", "utf-8");
>     }
>
> }
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>     <WebView
>         android:id="@+id/webview"
>             android:layout_height="200dip"
>             android:layout_width="240dip"
>             android:scrollbars="none"
>         />
> </LinearLayout>
>
> Android Academyhttp://www.androidacademy.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to