Xavier
Xavier

Reputation: 8362

Webview Width compared to Android Browser Width

So i've created a few html pages to embed into an application via WebView, the pages themselves work fine in the normal android browser HOWEVER within the WebView module the page's width is only 313, and it allows a bit of a horizontal scroll, this does not occur in a normal browser in Android.

So the desired width is 320px, WebView is outputting 313px but still allows a horizontal scroll (of a few pixels).

Below is my code for the layout, I assume Android is injecting some inline styles into the webview that I am not aware of, was wondering if anyone had the same problem?

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <WebView
        android:id="@+id/help_webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</RelativeLayout>

Upvotes: 0

Views: 789

Answers (1)

Caner
Caner

Reputation: 59178

It seems there are some differences between Webview and native browser:

Android WebView VS Phone Browser
http://groups.google.com/group/android-developers/browse_thread/thread/9fb826412233b9b4

Did you try setWebChromeClient()?
What's the difference between setWebViewClient vs. setWebChromeClient?

Upvotes: 1

Related Questions