Reputation: 825
I got some strange problem with my WebView. The problem is that I can't scroll the page in Android 2.2 and 2.3 if it's longer than the screen. The only way to scroll the WebView is in Android 4.0.3. What's the problem or is it just not possible to scroll the WebView in Android versions lower than 4.0.3?
This is my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent" android:id="@+id/rltvLayout01"
android:layout_height="fill_parent" android:background="@color/white">
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/ad_layout">
<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:scrollbars="none" />
</LinearLayout>
<LinearLayout android:id="@+id/ad_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<com.google.ads.AdView android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="-------------"
ads:loadAdOnCreate="true"
ads:adSize="BANNER" />
</LinearLayout>
</RelativeLayout>
EDIT 23:06:
I just found the problem! The actual code I'm using is not causing this behavior, it's the loaded website that's causing the problem. In my mobile website i'm using viewport to show it correctly and FroYo and Gingerbread's WebView can't handle that well. So after removing the viewport meta tag it works perfect! Thank you anyway Thomas K, the vertical orientation also made it scrollable after removing the viewport!
So get rid of the viewport tag in your html code if you want to have your webview working in Froyo and Gingerbread!
Upvotes: 1
Views: 11143
Reputation: 4199
Add
android:orientation="vertical"
or
android:orientation="horizontal"
to LinearLayout
Upvotes: 1