Alexis
Alexis

Reputation: 16829

I can't scroll vertically in a webview

In my android app I have a webview :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

<WebView
    android:id="@+id/webView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</LinearLayout>

My problem is that I can't scroll the page vertically. Horizontally it works pretty well but not vertically. Now if I set the size of android:layout_height to 400dp for example then it works! but then I can't support multiple screen sizes... any idea?

Upvotes: 0

Views: 8698

Answers (3)

Yousuf
Yousuf

Reputation: 39

To me it worked by enabling the javascript on the webview. So I guess there is some issue with webkit rendering a page that contains javascript if that flag is not set.

WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);

Upvotes: 2

Roman Black
Roman Black

Reputation: 3497

Add

android:orientation="vertical"

or

android:orientation="horizontal"

to LinearLayout

Upvotes: 2

FabianCook
FabianCook

Reputation: 20557

Maybe you could put the webview in a scroll view, by increasing the height to 400 dp you are putting it outside the limitations of the linear layout which creates a scroll view. when the page is loaded the linear layout doesn't take this into account.

Upvotes: 0

Related Questions