I am having some kind of weird issue with my WebView. The problem is that I cannot scroll the page in Android 2.2 and 2.3 if it is longer than the screen. The only way to scroll WebView is in Android 4.0.3. What is the problem or it is simply not possible to scroll WebView in Android versions below 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 a problem! The actual code I use does not cause this behavior, it is a loaded website that causes the problem. On my mobile site, I use viewport to show it correctly, and FroYo and Gingerbread WebView cannot handle this. So after removing the viewport meta tag, it works great! Thank you anyway Thomas K, the vertical orientation also made it scrollable after deleting the viewport!
So get rid of the viewport tag in your html code if you want your webview to work in Froyo and Gingerbread!
android webview
MartijnG May 11 '12 at 13:51 2012-05-11 13:51
source share